vertical-align Attribute | verticalAlign

HTML (DHTML)

vertical-align Attribute | verticalAlign Property

Internet Development Index

Sets or retrieves the vertical alignment of the object.

Syntax

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

Possible Values

sAlignVariant that specifies or receives one of the following values.
autoAligns the contents of an object according to the value of the layout-flow attribute.
baselineDefault. Aligns the contents of an object supporting VALIGN to the base line.
subVertically aligns the text to subscript.
superVertically aligns the text to superscript.
topVertically aligns the contents of an object supporting VALIGN to the top of the object.
middleVertically aligns the contents of an object supporting VALIGN to the middle of the object.
bottomVertically aligns the contents of an object supporting VALIGN to the bottom of the object.
text-topVertically aligns the text of an object supporting VALIGN to the top of the object.
text-bottomVertically 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.

Expressions can be used in place of the preceding value(s), as of Microsoft® Internet Explorer 5. 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 layout-flow is horizontal. When the 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) Non-Microsoft link.

Applies To

COL, currentStyle, CUSTOM, defaults, IMG, runtimeStyle, SPAN, style, TBODY, TD, TFOOT, TH, THEAD, TR

See Also

vAlign