Home How do I vertically center text with CSS?
Reply: 0

How do I vertically center text with CSS?

user690
1#
user690 Published in July 23, 2018, 9:59 am

I have a div element which contains text, and I want to align the contents of this div vertically center.

Here is my div style:

#box {
  height: 170px;
  width: 270px;
  background: #000;
  font-size: 48px;
  color: #FFF;
  text-align: center;
}
<div id="box">
  Lorem ipsum dolor sit
</div>

What is the best way to do this?

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.491148 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO