3 out of 10 rated this helpful - Rate this topic

vertical-align property

Sets or retrieves the vertical alignment of the object.

CSS 2.1, Section 5.4.4

Syntax

vertical-align: baseline | sub | super | top | text-top | middle | bottom | text-bottom

Property values

auto

Aligns the contents of an object according to the value of the -ms-layout-flow attribute.

baseline

Default. Aligns the contents of an object supporting VALIGN to the base line.

sub

Vertically aligns the text to subscript.

super

Vertically aligns the text to superscript.

top

Vertically aligns the contents of an object supporting VALIGN to the top of the object.

middle

Vertically aligns the contents of an object supporting VALIGN to the middle of the object.

bottom

Vertically aligns the contents of an object supporting VALIGN to the bottom of the object.

text-top

Vertically aligns the text of an object supporting VALIGN to the top of the object.

text-bottom

Vertically aligns the text of an object supporting VALIGN to the bottom of the object.

CSS information

Applies ToAll elements
Mediavisual
Inheritedno
Initial Value

Standards information

Remarks

The sub and super values are supported on text. The auto value is supported on the currentStyle object. The other values are supported on objects that support VALIGN.

The auto value is identical to the baseline value when the -ms-layout-flow is horizontal. When the -ms-layout-flow is vertical-ideographic, the auto value is identical to the middle value.

Examples

This example uses the vertical-align property to align text within a table cell.

Code example: http://samples.msdn.microsoft.com/workshop/samples/author/dhtml/refs/verticalAlign.htm


 <TABLE BORDER width=100>
<TR>
    <TD onmouseover="this.style.verticalAlign='bottom'" 
    onmouseout="this.style.verticalAlign=''">
    text to align</TD> 
</TR>
</TABLE>

See also

CSSStyleDeclaration
currentStyle
defaults
runtimeStyle
style
vAlign

 

 

Send comments about this topic to Microsoft

Build date: 11/29/2012

Did you find this helpful?
(1500 characters remaining)

Community Additions

ADD
© 2013 Microsoft. All rights reserved.