Home › Forums › CSS › Trying to center text in circles and make responsive › Reply To: Trying to center text in circles and make responsive
May 11, 2016 at 1:26 pm
#241525
Member
Like this?
https://jsfiddle.net/kob688zr/1/
The first rule for centering elements is “Don’t use floats”.
display:inline-block
with text-align:center
on the parent is usually enough although I tend towards flexbox more these days.
Since you have a defined height for the circles you can use the same value for line-height
and the text will vertically center (as long as there is only one line of text as here)…again, flexbox is perhaps more modern and doesn’t care about the number of lines of text, generally.