Struggling to achieve a circle-shaped div with centered text? While it's easy to horizontally align text in the middle, achieving vertical centering can be a challenge. Various methods such as vertical-align, padding, and display have been attempted, but the text still stubbornly remains at the top.
Take a look at the HTML causing the issue:
<div class="widget">
<p id='case'>{27 cases}</p>
</div>
Check out the CSS for the problematic div:
.widget {
background-color: #ff1122;
color: yellow;
width: 150px;
height: 150px;
border-radius: 100%;
text-align: center;
font-size: 24px;
vertical-align: middle;
}
Striving to place the text precisely in the vertical middle of the circular div? Looking for a solution to this challenge. Can you help?