In my previous post, How to draw circle with CSS, we saw drawing of circle using CSS box-radius style. In this post I will show another aspect of syntax of box-radius style to draw an ellipse. An oval shape is ellipse which has major-axis length idfferent from minor-axis. In previous post I only used one value for box-radius.
box-radius: horizontalRadius / verticalRadius
For simplicity sake I have only used one value. As you can see there are two components of border-radius to control radius along horizontal and vertical direction. If you do not specify vertical radius value, browser will use horizontal radius value for vertical radius as well.
Based on the above information about syntax, to draw ellipse we need to specify different values for horizontal and vertical radius. Here is what you will need to draw ellipse.
Here is an example of style example I used to draw an ellipse using CSS.
.ellipseDiv { height:50px; width:100px; border: 2px solid #005; border-radius:50px / 25px; background-color:#EE5D20; } |
How to plan CCSP Exam preparation
Develop a MongoDB pipeline to transform data into time buckets
Alert and Confirm pop up using BootBox in AngularJS
AngularJS Grouped Bar Chart and Line Chart using D3
How to lock and unlock account in Asp.Net Identity provider
2024 © Byteblocks, ALL Rights Reserved. Privacy Policy | Terms of Use