The forums ran from 2008-2020 and are now closed and viewable here as an archive.
Home › Forums › CSS › [Solved] Perfectly fit text within CSS circle
Hey,
What is the best way of perfectly fitting text within a circle using CSS?
http://i.imgur.com/1q9xUPK.png
/\ This is the problem I’m having. I think I may have to use JS to change the font size but if there is a way to achieve it with pure css, that would be good
Whatever the height of the div is…say 50px….use the same for the line-height (one line text only) and then text-align:center
line-height
text-align:center
Yep, Paulie is right. Match the height of the circle with the line-height. Example below.
http://codepen.io/anon/pen/cewfA
Perfect, thanks!