How to achieve this oval layout with CSS


Tags: html,css,css3

Problem :

How to achieve this layout with CSS?

enter image description here



Solution :

You can try this: https://jsfiddle.net/dqhx5cf5/

HTML:

<div class="rectangle"><div class="circle"></div></div>

CSS:

.rectangle{
   background-color: darkblue;
   width: 300px;
   height: 500px;
   overflow:hidden;
}

.circle{
   border-radius: 50%;
   width: 600px;
   height: 600px;
   background-color: #ddd;
   position:relative;
   left: -150px;
   top: 100px;
   border: 2px dashed darkblue;
   box-shadow: 0 0 0px 5px #ddd;
}

BUT with Firefox the curved line does not appear dashed because is not compatible with mozilla, but if you check it from IE and Chrome it works as well.


    CSS Howto..

    How to show/hide content on click with CSS

    (HTML/CSS) How to align a text to middle of center (in both x and y axis)? [duplicate]

    how to make a line between div boxes - simple timeline experiment

    How to rearrange these elements with CSS?

    How to change font color of select2 control using css

    How to concatenate and minify multiple CSS and JavaScript files with Grunt.js (0.3.x)

    How to render checked checkboxes using CSS alone?

    How to make a box with arrow in CSS?

    How to reuse footer with only HTML/CSS?

    How to have background between two handles of jQuery Slider using css gradient

    How to style google cse

    How to override custom placeholder css

    How to center list

    How to center a div with CSS?

    How to eliminate the overlap border using CSS only

    How do I get a floating footer to stick to the bottom of the viewport in IE 6?

    How to optimize my css/html webpage? [closed]

    How to apply custom size to text field in rails

    How to avoid universal Rule CSS Asterisk(*)?

    How to code a drop down menu in css?

    How can I easily copy the whole CSS file from a website?

    CSS Button Animation - How to Accomplish?

    How to turn off materialize css containers when on mobile?

    How to hide a div on certain pages using CSS

    Best practice: How to use (repeat) CSS style attributes correctly?

    How to elasticity of the char length in javascript or css? [duplicate]

    How can I make browser scale image frames according to CSS before loading actual images into frames?

    I can't figure out how to get display property to work when it comes to multiple div elements

    How to put the table inside the box

    How can I animate my div to go from top to bottom whithout interfering with the content inside?