CSS vertical-alignProperty


Example

Vertically align image:

img { vertical-align:text-top; }

Try it Yourself »

Attribute definition and usage instructions

The vertical-align property sets the vertical alignment of an element.

This property defines the vertical alignment of the baseline of an inline element relative to the baseline of the line containing the element. Negative length values and percentage values are allowed. This will lower the element rather than raise it. In table cells, this property sets the alignment of the cell content within the cell box.

Default value: baseline
Inherited: no
version: CSS1
JavaScript Syntax: object.style.verticalAlign="bottom"


Browser Support

The numbers in the table indicate the first browser version that supports the property.

Property
vertical-align 1.0 4.0 1.0 1.0 4.0

Property value

Value Description
baseline Default. The element is placed on the baseline of the parent element.
sub Vertically aligns text as subscript.
super Vertically aligns text as superscript.
top Aligns the top of the element with the top of the tallest element in the line.
text-top Aligns the top of the element with the top of the parent element's font.
middle Places this element in the middle of the parent element.
bottom Aligns the bottom of the element and its descendant elements with the bottom of the entire line.
text-bottom Aligns the bottom of the element with the bottom of the parent element's font.
length Raises or lowers the element by the specified height. Can be negative.
% Uses a percentage value of the "line-height" property to align this element. Negative values are allowed.
inherit Specifies that the value of the vertical-align property should be inherited from the parent element.


Related Articles

CSS Tutorial:CSS Text

other extensions