JSFiddle - React, Tailwind, and code Playground
by dhavaljani
HTML
<ul>
<li>A</li>
</ul>
<ul>
<li>A</li>
<li>B</li>
</ul>
<ul>
<li>A</li>
<li>B</li>
<li>C</li>
</ul>
<ul>
<li>A</li>
<li>B</li>
<li>C</li>
<li>D</li>
</ul>
<ul>
<li>A</li>
<li>B</li>
<li>C</li>
<li>D</li>
<li>E</li>
</ul>
CSS
* {
font-family: sans-serif;
box-sizing: border-box;
}
ul {
padding: 0;
height: 150px;
width: 150px;
border-radius: 50%;
display: block;
overflow: hidden;
border: 2px solid #fff;
}
li {
float: left;
text-align: center;
color: #fff;
font-weight: bold;
background-color: mediumaquamarine;
list-style: none;
border: 1px solid #fff;
padding: 8px;
display: block;
width: 100%;
}
/* one item */
li:first-child:nth-last-child(1) {
height: 100%;
}
/* two items */
li:first-child:nth-last-child(2),
li:first-child:nth-last-child(2) ~ li {
height: 50%;
}
/* three items */
li:first-child:nth-last-child(3),
li:first-child:nth-last-child(3) ~ li {
height: 33.3333%;
}
/* four items */
li:first-child:nth-last-child(4),
li:first-child:nth-last-child(4) ~ li {
height: 25%;
}
/* five items */
li:first-child:nth-last-child(5),
li:first-child:nth-last-child(5) ~ li {
height: 20%;
}