vertical-align and div

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
hi, why doesn't the vertical-align work here:

div.test {top:10px;

i want to put the text in the center of the block


Re: vertical-align and div

Quoted text here. Click to load it

Are you specifying position somewhere else? top and left only apply
when an element has a position value other than static (the default).

Quoted text here. Click to load it

Because  vertical-align only applies in two cases -
1. inline elements where it aligns the element relative to the
surrounding line  of text
2. table cell elements where it aligns the content relative to the

It does not apply to block level elements.

You can convert a block element like <div> into a teble cell element
by using display: table-cell; but IE doesn't support that.

Quoted text here. Click to load it


"My theories appal you, my heresies outrage you,
 I never answer letters and you don't like my tie."  - The Doctor

Site Timeline