CSS Property: vertical-align
The vertical alignment of an inline box or text, or table cell.
Possible Values
Value | Description | Example |
---|---|---|
[length] | Raises (positive value) or lowers (negative value) the text/box. 0 is equal to the baseline. | 5px |
[percentage] | Raises (positive value) or lowers (negative value) the text/box. Calculated in relation to the line-height. 0% is equal to the baseline, 100% is one times the line-height, etc. | 10% |
baseline | Aligns the baseline of the text/box with the baseline of its containing box. Default. | |
sub | Lowers the baseline to subscript level. | |
super | Raises the baseline to superscript level. | |
top | Aligns to the top of the line or table cell. | |
text-top | Aligns to the top of the text of the containing box. | |
middle | Aligns to the middle of the text of the containing box or to the middle of the table cell. | |
bottom | Aligns to the bottom of the line or table cell. | |
text-bottom | Aligns to the bottom of the text of the containing box. | |
inherit | ||
initial | ||
unset |
Example
h2 em {
font-size: 0.5em;
vertical-align: text-top;
}
td { vertical-align: top; }