Divide circle into 24 segments using css

I created a circle using css. Now I want to divide it into 24 segments. How to do it using css. Help me. Here's my code for how I created the circle:

<div class="circle"></div>
.circle{

            width: 50px;
            height: 50px;
            border-radius: 50%;
            background-color: blue
            }

      

Final Result looks like this:

+3


source to share


1 answer


You can do this more easily using Scalable Vector Graphics.

the code for drawing the circle:

<svg xmlns="http://www.w3.org/2000/svg" version="1.1">
   <circle cx="150" cy="100" r="50" stroke="blue" stroke-width="2" fill="white"/>
</svg>

      



You can draw different lines so that you can divide the circle into segments.

Code for line:

<svg xmlns="http://www.w3.org/2000/svg" version="1.1">
   <line x1="0" y1="0" x2="200" y2="200" style="stroke:rgb(255,0,0);stroke-width:2"/>
</svg> 

      

0


source







All Articles