Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS Trying to center text in circles and make responsive Reply To: Trying to center text in circles and make responsive

#241525
Paulie_D
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.