Asked • 05/11/19

CSS center text (horizontally and vertically) inside a div block?

I have a `div` set to `display:block`. (`90px` `height` and `width`) and I have some text inside.I need the text to be aligned in the center both vertically and horizontally.I have tried `text-align:center`, but it doesn't do the horizontal part so I tried `vertical-align:middle` but it didn't work.Any ideas?

1 Expert Answer

By:

Gabriel F. answered • 10/29/19

Tutor
5.0 (85)

Full Stack Software Developer and Mentor

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.