Style verticalAlign property

Definition and usage

verticalAlign Sets or returns the vertical alignment of the content within an element.

See also:

CSS Tutorial:CSS Text

CSS Reference Manual:vertical-align property

Instance

Example 1

Sets the vertical alignment of some text in the table to "bottom":

document.getElementById("myTd").style.verticalAlign = "bottom";

Try it yourself

Example 2

Returns the vertical alignment of the <td> element:

alert(document.getElementById("myTd").style.verticalAlign);

Try it yourself

Syntax

Return verticalAlign property:

object.style.verticalAlign

Set verticalAlign property:

object.style.verticalAlign = value

Property value

Value Description
length Rises or lowers the element by a specified length. Negative values are allowed.
% Rises or lowers the element by a percentage of the 'line-height' property. Negative values are allowed.
baseline Aligns the baseline of the element with the baseline of the parent element. Default.
sub Aligns the element as an subscript.
super Aligns the element as a superscript.
top The top of the element aligns with the top of the highest element in the line.
text-top The top of the element aligns with the font top of the parent element.
middle The element is placed in the middle of the parent element.
bottom The bottom of the element aligns with the lowest element in the line.
text-bottom The bottom of the element aligns with the font bottom of the parent element.
initial Sets this property to its default value. See initial.
inherit Inherits this property from its parent element. See inherit.

Technical details

Default value: baseline
Return value: A string indicating the vertical alignment of the content within an element.
CSS Version: CSS1

Browser Support

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
Support Support Support Support Support