简体   繁体   中英

Vertically align more than one line of text?

I'm using:

#leftfoot {padding-left: 20px; vertical-align: middle;}

It does not work. I've look at plenty of explanations, none of them seem to work for me. Does anybody else know how to vertically align more than one line of text?

Shakes fist angrily at CSS.

#leftfoot {
    height: 110px;
    display:table-cell;
    vertical-align: middle;
    padding-left: 20px;
}

Your issue is the following: Your text was indeed centered vertically, but your inner div had just the same height as the text and was not extending to the bounds of the outer div, so you have to set a height for the inner div to work.

Your question is not clear, create a JsFiddle. For better understanding of Vertical-align http://css-tricks.com/what-is-vertical-align/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM