Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

problem with vertical align

Status
Not open for further replies.

jemminger

Programmer
Jun 25, 2001
3,453
US
hi all,

how come this doesn't work? in ie, i get the outer span at 100% tall, but the inner span is aligned at top. in mozilla, i get both spans just wrapped around the text. shouldn't this make the outer span 100% tall with the inner span aligned in the middle vertically?

<body>
<span style=&quot;height:100%;border:1px solid red;&quot;>
<span style=&quot;vertical-align:middle;border:1px solid blue;&quot;>middle</span>
</span>
</body>


=========================================================
try { succeed(); } catch(E) { tryAgain(); }
-jeff
 
I know that IE has a problem with span's and reading the style attrib's correctly. not sure if this was fixed in 6 but I have adapted to using div's instead do to this and other things I've noticed.

____________________________________________________
The most important part of your thread is the subject line.
Make it clear and about the topic so we can find it later for reference. Please!! faq333-2924

onpnt2.gif
 
hmm..changing to <div> gets mozilla to make the outer <div> 100% tall, but the inner is still top-aligned.

=========================================================
try { succeed(); } catch(E) { tryAgain(); }
-jeff
 
The vertical-align property isn't for setting the vertical alignment within the element, it's to set the vertical alignment of the element itself against the elements around it. Like for text or an <img> tag.
IMG { vertical-align: text-top }

Try this:
<div style=&quot;height:100%;border:1px solid red;&quot;>
<div style=&quot;position:absolute; top:50%;&quot;>
<div style=&quot;position:relative; top:-50%;border:1px solid blue;&quot;>middle<br>middle<br>middle<br>middle</div>
</div>
</div>


Adam
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top