CSS Attributes Index Text Attributes
Sets or retrieves the vertical positioning of the object.
CSS |
{ vertical-align: 'baseline' | 'sub' | 'super' | 'top' | 'middle' | 'bottom' | 'text-top' | 'text-bottom' } |
Script |
object.style.verticalAlign = sAlign ] |
baseline |
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 with a default value of baseline; the CSS attribute is not inherited.
The values sub and super are supported on text. The other values are supported for objects that support VALIGN.
The following example demonstrates the effects of applying the different values possible for the CSS vertical-align attribute.
Show me
The following example demonstrates the use of the verticalAlign property to dynamically align text within a table cell in response to mouse events.
<table border width=80% cellpadding=10>
<tr>
<td onmouseover="this.style.verticalAlign='bottom'"
onclick="this.style.verticalAlign='top'"
onmouseout="this.style.verticalAlign=''" nowrap>text to align</td>
...
</table>
Show me
CAPTION, COL, currentStyle, IMG, runtimeStyle, SPAN, style, TABLE, TBODY, TD, TFOOT, TH, THEAD, TR