Template:Vertical-align
Appearance
The template aligns the element vertically inside the enclosing (parent) element (for example, surrounding text, a div element, or a table cell). It takes three unnamed parameters:
- The first parameter controls vertical alignment. Allowed values:
baseline— aligns the baseline of the parent element with the baseline of the first line of text or another nested element.bottom— aligns to the bottom edge of the parent element.middle— aligns to the middle of the parent element.top— aligns to the top edge of the parent element.
- The second parameter: the nested element whose alignment is to be provided.
- The third (optional) parameter: if non-empty, the template works in an inline context.
Examples
[edit]<div style="border:1px solid black; height:50px;">{{Vertical-align|bottom|I'm at the bottom}}</div>I'm at the bottom<div style="border:1px solid black; height:50px;">{{Vertical-align|middle|I'm in the middle}}</div>I'm in the middle<div style="border:1px solid black; height:50px;">{{Vertical-align|top|I'm at the top}}</div>I'm at the top
- Inline context example:
<math>\begin{align} \cos 2x &= 1 - 2 \sin^2 x \\ &= \cos^2 x - \sin^2 x \\ &= 2 \cos^2 x - 1. \end{align}</math>{{Vertical-align|bottom|← bottom line|1}}{{Vertical-align|middle|← middle line|1}}{{Vertical-align|top|← top line|1}}
- ← bottom line← middle line← top line