I'm trying to show a percentage within a circle that is perfectly aligned in the center of the element. Cool, this works.
But, I want the numeric value aligned center while the "%" floats next to and doesn't affect the placement.
See codepen: https://codepen.io/brycesnyder/pen/MEwddv
div {
font-family: sans-serif;
height: 200px;
width: 200px;
background: #ae63e4;
border-radius: 50%;
display: inline-flex;
align-items: center;
justify-content: center;
font-size: 60px;
line-height: 1;
color: white;
text-align: center;
}
div.percent:after {
content: '%';
font-size: 30px;
margin-bottom: 15px;
}
div.a-percent {
position: relative;
background: #0ebeff;
}
div.a-percent:after {
content: '%';
position: absolute;
font-size: 30px;
margin-top: 5px;
}
<div class="percent">0</div>
<div class="percent">10</div>
<div class="percent">100</div>
<br>
<br>
<div class="a-percent">0</div>
<div class="a-percent">10</div>
<div class="a-percent">100</div>