vertical-align and div

  • Thread starter Jochen Fuhrmann
  • Start date
J

Jochen Fuhrmann

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

div.test {top:10px;
left:10px;
width:230px;
height:90px;
text-align:center;
vertical-align:middle;}

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

jochen
 
S

Steve Pugh

Jochen Fuhrmann said:
hi, why doesn't the vertical-align work here:

div.test {top:10px;
left:10px;

Are you specifying position somewhere else? top and left only apply
when an element has a position value other than static (the default).
width:230px;
height:90px;
text-align:center;
vertical-align:middle;}

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
cell

It does not apply to block level elements.

http://www.w3.org/TR/CSS2/visudet.html#propdef-vertical-align

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

http://www.aspekt1.net/ms/dev/vertical-align.html

Steve
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top