mozilla

# Revision 24609 of vertical-align

• Revision slug: CSS/vertical-align
• Revision title: vertical-align
• Revision id: 24609
• Created:
• Creator: Mgjbot
• Is current revision? No

## Revision Content

{{template.CSSRef()}}

### Summary

The vertical-align property specifies the vertical alignment of an inline or table-cell element.

• Initial Value: baseline
• Applies to: inline elements and table cells
• Inherited: No

### Syntax

vertical-align: baseline | sub | super | text-top | text-bottom | middle | top | bottom | <percentage> | <length> | inherit

### Values (for inline elements)

Most of the values vertically align the element relative to its parent element:

baseline
Align the baseline of the element with the baseline of its parent.
sub
Align the baseline of the element with the subscript-baseline of its parent.
super
Align the baseline of the element with the superscript-baseline of its parent.
text-top
Align the top of the element with the top of the parent element's font.
text-bottom
Align the bottom of the element with the bottom of the parent element's font.
middle
Align the middle of the element with the middle of lowercase letters in the parent.
<length>
Align the baseline of the element at the given length above the baseline of its parent.
<percentage>
like <length> values, with the percentage being a percent of the {{template.Cssxref("line-height")}} property

For elements that do not have a baseline, the bottom margin edge is used instead.

However, two values vertically align the element relative to the entire line rather than relative to its parent:

top
Align the top of the element and its descendants with the top of the entire line.
bottom
Align the bottom of the element and its descendants with the bottom of the entire line.

Negative values are allowed.

### Values (for table cells)

baseline (and sub, super, text-top, text-bottom, <length>, and <percentage>)
Align the baseline of the cell with the baseline of all other cells in the row that are baseline-aligned.
top
Align the top padding edge of the cell with the top of the row.
middle
Center the padding box of the cell within the row.
bottom
Align the bottom padding edge of the cell with the bottom of the row.

Negative values are allowed.

### Examples

```img {
vertical-align: bottom;
}
```
{{ wiki.languages( { "pl": "pl/CSS/vertical-align" } ) }}

## Revision Source

```<p>
{{template.CSSRef()}}
</p>
<h3 name="Summary"> Summary </h3>
<p>The vertical-align property specifies the vertical alignment of an inline or table-cell element.
</p>
<ul><li> Initial Value: baseline
</li><li> Applies to: inline elements and table cells
</li><li> Inherited: No
</li></ul>
<h3 name="Syntax"> Syntax </h3>
<p><b>vertical-align: baseline | sub | super | text-top | text-bottom | middle | top | bottom | &lt;percentage&gt; | &lt;length&gt; | inherit</b>
</p>
<h3 name="Values_.28for_inline_elements.29"> Values (for inline elements) </h3>
<p>Most of the values vertically align the element relative to its parent element:
</p>
<dl><dt>baseline </dt><dd>Align the baseline of the element with the baseline of its parent.
</dd><dt>sub </dt><dd>Align the baseline of the element with the subscript-baseline of its parent.
</dd><dt>super </dt><dd>Align the baseline of the element with the superscript-baseline of its parent.
</dd><dt>text-top </dt><dd>Align the top of the element  with the top of the parent element's font.
</dd><dt>text-bottom </dt><dd>Align the bottom of the element with the bottom of the parent element's font.
</dd><dt>middle </dt><dd>Align the middle of the element with the middle of lowercase letters in the parent.
</dd><dt>&lt;length&gt; </dt><dd>Align the baseline of the element at the given length above the baseline of its parent.
</dd><dt>&lt;percentage&gt; </dt><dd>like &lt;length&gt; values, with the percentage being a percent of the {{template.Cssxref("line-height")}} property
</dd></dl>
<p>For elements that do not have a baseline, the bottom margin edge is used instead.
</p><p>However, two values vertically align the element relative to the entire line rather than relative to its parent:
</p>
<dl><dt>top </dt><dd>Align the top of the element and its descendants with the top of the entire line.
</dd><dt>bottom </dt><dd>Align the bottom of the element and its descendants with the bottom of the entire line.
</dd></dl>
<p>Negative values are allowed.
</p>
<h3 name="Values_.28for_table_cells.29"> Values (for table cells) </h3>
<dl><dt>baseline (and sub, super, text-top, text-bottom, &lt;length&gt;, and &lt;percentage&gt;) </dt><dd> Align the baseline of the cell with the baseline of all other cells in the row that are baseline-aligned.
</dd><dt>top</dt><dd> Align the top padding edge of the cell with the top of the row.
</dd><dt>middle</dt><dd> Center the padding box of the cell within the row.
</dd><dt>bottom</dt><dd> Align the bottom padding edge of the cell with the bottom of the row.
</dd></dl>
<p>Negative values are allowed.
</p>
<h3 name="Examples"> Examples </h3>
<pre>img {
vertical-align: bottom;
}
</pre>
{{ wiki.languages( { "pl": "pl/CSS/vertical-align" } ) }}```