vertical-align Attribute | verticalAlign Property

Sets or retrieves the vertical alignment of the object.

Syntax

HTML { vertical-align : sAlign }
Scripting[ sAlign = ] object.style.verticalAlign

Possible Values

sAlignString that specifies or receives one of the following 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.

The property is read/write for all objects except the following, for which it is read-only: currentStyle. The property has a default value of baseline for all objects with the exception of currentStyle which has a default value of auto. The Cascading Style Sheets (CSS) attribute is not inherited.

DHTML expressions can be used in place of the preceding value(s). As of Internet Explorer 8, expressions are not supported in IE8 mode. For more information, see About Dynamic Properties.

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.

Example

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

 <TABLE BORDER width=100>
<TR>
    <TD onmouseover="this.style.verticalAlign='bottom'" 
    onmouseout="this.style.verticalAlign=''">
    text to align</TD> 
</TR>
</TABLE>
This feature requires Microsoft Internet Explorer 4.0 or later. Click the following icon to install the latest version. Then reload this page to view the sample.

Standards Information

This property is defined in Cascading Style Sheets (CSS), Level 1 (CSS1) World Wide Web link.

Applies To

COL, currentStyle, CUSTOM, defaults, IMG, runtimeStyle, SPAN, style, TBODY, TD, TFOOT, TH, THEAD, TR, CSSCurrentStyleDeclaration Constructor, CSSRuleStyleDeclaration Constructor, CSSStyleDeclaration Constructor

See Also

vAlign
Tags :


Page view tracker