Reputation: 42
I am trying to create an oblique oval in CSS/HTML, but having some issues.
I have tried creating a normal oval and then rotating it a few degrees according to the code below, but it just rotates the underlying rectangle and applies the bordier radius thereafter.
Here is what I tried:
.circle{
width:100px;
height:50px;
border-radius:50px;
background:#000;
-webkit-transform: rotate(27deg);
}
Upvotes: 1
Views: 1563
Reputation: 10698
You shall use a relative border-radius
, and set it to 50% to have a perfect oval.
Then, you could try with skew
instead :
.circle{
-webkit-transform: skew(27deg);
}
Will render this :
While rotate
will render this:
Upvotes: 1
Reputation: 4793
Try making your border radius 50% (or 500px)
border-radius:50%;
Edit: to improve my answer, the code you posted is correct for creating an oblique oval, except that the border radius is not correct. It needs to be 50%, as that makes perfect corners, eg. for a circle. Then you just use the width/height to stretch the circle to get an oval, and use the transform:rotate(27deg);
to make it an oblique oval.
Upvotes: 0