Geo
Geo

Reputation: 2711

How to make oval-ish shape in css

I am trying to make this grey shape using a css class. enter image description here

I thought using a border-raduis would work. The shape is close but is still off.

I currently have this:

enter image description here

This is the css that i'm using:

.total--races {
    text-align: right;
    font-size: 32px;
    background: #44ade2;
    color: #fff;
    width: 78px;
    height: 88px;
    border-radius: 50px 0px 0px 50px;
}

and this html :

<div className="total--races">
   {get(meeting, 'races', '') && 
   Object.keys(meeting.races).length}
</div>

Any suggestion of how to make my shape look close would help. Thanks.

Upvotes: 1

Views: 187

Answers (1)

Temani Afif
Temani Afif

Reputation: 274385

use radial-gradient without the need of border-radius

.total--races {
  text-align: right;
  font-size: 32px;
  color: #fff;
  width: 78px;
  height: 88px;
  background: 
    radial-gradient(circle at right center,#44ade2 70%,transparent 72%);
}
<div class="total--races">
  99<br>text
</div>

To have better control use explicit radius:

.total--races {
  text-align: right;
  font-size: 32px;
  color: #fff;
  width: 78px;
  height: 88px;
  background: 
    radial-gradient(80% 110% at right center,#44ade2 98%,transparent 100%);
}
<div class="total--races">
  99<br>text
</div>

Upvotes: 4

Related Questions