I have a filled circle that contains a number like so:
How would I go about splitting this into two semi-circles, so that I can store two different numbers within it, like so:
My CSS is as follows:
.oval {
display: inline-block;
width: 75px;
height: 75px;
border-radius: 50%;
background: #000000;
color: white;
line-height: 75px;
font-size: medium;
}
SVG solution
This seems like a graphical problem. So i would suggest to use SVG instead of CSS to create such a shape.
You only need to add a line in the middle (either using a pseudo-element or using a gradient like in the below snippet) and then place the content inside it using two
span
elements.Or you can do it like in the below snippet where the semi-circles are created using a pseudo-element.
Or you can even use
radial-gradient
background. This is just another method (for fun) and I don't really recommend this option.You can use
border-radius
Or you can use SVG
Update: You could also just create circle with two spans inside and add one line in middle with pseudo-class