PDA

View Full Version : valign div tags


kathryn
11-22-2002, 08:30 AM
Hi,
I have a set of <div> tage which I am using combined with layers to create a drop down menu.
<DIV CLASS="TRS" ID="TRS" STYLE=" left: 282px; top:193px">
<DIV><A HREF="#" onMouseOver="show('',2,this)">Text 1</A></DIV>
<DIV><A HREF="#" onMouseOver="show('',2,this)">Text 2</A></DIV>
<DIV><A HREF="#" onMouseOver="show('',2,this)">Text 3</A></DIV>
</DIV>

My problem is that I cannot get the text withing the inner <div's> eg. Text 1, Text 2 or Text 3 to vertically align to the middle??
I have tried adding style="vertical-align: middle;" to the inner div tags and the outer one nothing seems to work???
Does anyone have any ideas???
Thanks, Kathryn

MCookie
11-22-2002, 12:20 PM
QUOTE: The vertical-align property allows a wide variety of choices for aligning characters, letters, words, and text with regard to the baseline of a selected line of characters, letters, words, or text.

..so you can't use 'vertical-align' to put an entire block of text in the middle of a div like valign="top" in a table cell.
Try 'padding-top' in the outer div.

kathryn
11-22-2002, 01:13 PM
I actually put the padding styles into each of the ahref tags and this worked perfectly
thanks for your help, Kathryn

bk1
11-22-2002, 07:04 PM
For what it's worth...

vertical-align in CSS only applies to inline elements. DIVs by default are block-level, which is why that wouldn't work... Padding was a good solution to use.