I want to show a circle in webpage at some X and Y and then show title text just above the circle.
What I want is - Center of the text should match with center of circle vertically(Y).
Even when the length of text is increased at run-time, the text should still be centered.
Circle dia and text length are variable.
I tried to use text-align center
, but could not achieve.
html -
<div id="par">
<div id="txt">Some Text</div>
<div id="circ"></div>
</div>
css -
#par{
text-align: center;
}
#txt{
background-color: red;
}
#circ {
width: 100px;
height: 100px;
border-radius: 50%;
background-color: green;
}