XML technologies / XSL-FO / Reference / Attributes in XSL-FO / vertical-align

(Excerpt from "XSL-FO ― Die Referenz" by Manuel Montero Pineda & Steffen Herkert, 2016, dpunkt.verlag)

A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z

Recommendation section: 7.31.22

Category: 7.31 Shorthand Properties

Description

This attribute sets the vertical alignment of inline areas and table cells relative to their parent elements.

Values

baseline

This value aligns the box’s baseline with its parent’s baseline.

top

This value aligns the top of the box.

bottom

This value aligns the bottom of the box.

middle

This value aligns the vertical midpoint with the parent box’s baseline plus half the parent’s x-height.

sub

This value subscripts characters, such as numbers in chemical formulas (H2O).

super

This value superscripts characters, such as the number in square meters (m²).

text-top

This value aligns the top of the box with the top of the parent element’s font.

text-bottom

This value aligns the bottom of the box with the bottom of the parent element’s font.

Percentage

The box is raised or lowered by this percentage of line-height. Here, 0% has the same effect as baseline.

Length

A length consisting of a number and a unit; common units are mm, pt, px, cm, and pc. The box is raised or lowered by an absolute amount. Here, 0mm has the same effect as baseline.

Relative length

The top edge of a positioned object can be specified relative to its parent’s top edge in em (relative to the width of the uppercase letter "M" in the font used) or in ex (relative to the height of the lowercase letter "x").

Absolute length

The top edge of a positioned object can be fixed using an absolute measurement from the parent element’s top edge.

Inherited:

yes

Default value: baseline

XSL-FO version: 1.0

Allowed in:

<fo:basic-link> , <fo:character> , <fo:external-graphic> , <fo:inline> , <fo:inline-container> , <fo:instream-foreign-object> , <fo:leader> , <fo:page-number> , <fo:page-number-citation> , <fo:page-number-citation-last> and <fo:scaling-value-citation>

Support:

Conformance level

Antenna House

FOP

RenderX XEP

Altsoft XML2PDF

Compart DocBridge

Complete

Y

P

Y

Y

Y

XSL-FO example:

<fo:root font-family="Arial" font-size="10pt" line-height="1.2em" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:cpfo="http://www.compart.net/xmlns/cpfo" xmlns:svg="http://www.w3.org/2000/svg" xmlns:axf="http://www.antennahouse.com/names/XSL/Extensions">
<fo:layout-master-set>
<fo:simple-page-master master-name="Inhalt-Seiten" margin="0mm 0mm 0mm
                      0mm" page-height="297mm" page-width="210mm">
<fo:region-body margin="15mm 10mm 20mm
                        10mm"/>
</fo:simple-page-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="Inhalt-Seiten">
<fo:flow flow-name="xsl-region-body">
<fo:block-container keep-together.within-line="1">
<fo:block-container z-index="2">
<fo:block font-family="Arial Unicode
                    MS" font-size="17pt" text-decoration="underline">

                vertical-align="baseline" ण
<fo:inline vertical-align="baseline">
अउ
</fo:inline>
एऊ
</fo:block>
<fo:block font-family="Arial Unicode
                    MS" font-size="17pt" text-decoration="underline" space-before="1em">
 vertical-align="sub" Als 
<fo:inline vertical-align="sub">
Gregor Samsa
</fo:inline>
 eines Morgens aus unruhigen Träumen erwachte, fand er sich in seinem Bett zu einem
                ungeheueren Ungeziefer verwandelt.
</fo:block>
<fo:block font-family="Arial Unicode
                    MS" font-size="17pt" text-decoration="underline" space-before="1em">

                vertical-align="super" Als 
<fo:inline vertical-align="super">
Gregor Samsa
</fo:inline>
 eines Morgens
                aus unruhigen Träumen erwachte, fand er sich in seinem Bett zu einem ungeheueren
                Ungeziefer verwandelt.
</fo:block>
<fo:block font-family="Arial Unicode
                    MS" font-size="17pt" text-decoration="underline" space-before="1em">
 vertical-align="text-top" Als 
<fo:inline vertical-align="text-top">
Gregor Samsa
</fo:inline>
 eines Morgens aus unruhigen Träumen erwachte, fand er sich in seinem Bett zu einem
                ungeheueren Ungeziefer verwandelt.
</fo:block>
<fo:block font-family="Arial Unicode
                    MS" font-size="17pt" text-decoration="underline" space-before="1em">

                vertical-align="text-bottom" Als 
<fo:inline vertical-align="text-bottom">
Gregor Samsa
</fo:inline>
 eines Morgens
                aus unruhigen Träumen erwachte, fand er sich in seinem Bett zu einem ungeheueren
                Ungeziefer verwandelt.
</fo:block>
<fo:block font-family="Arial Unicode
                    MS" font-size="17pt" text-decoration="underline" space-before="1em">
 vertical-align="50%" Als 
<fo:inline vertical-align="50%">
Gregor Samsa
</fo:inline>
 eines Morgens aus unruhigen Träumen erwachte, fand er sich in seinem Bett zu einem
                ungeheueren Ungeziefer verwandelt.
</fo:block>
<fo:block font-family="Arial Unicode
                    MS" font-size="17pt" text-decoration="underline" space-before="1em">

                vertical-align="-10pt" Als 
<fo:inline vertical-align="-10pt">
Gregor Samsa
</fo:inline>
 eines Morgens
                aus unruhigen Träumen erwachte, fand er sich in seinem Bett zu einem ungeheueren
                Ungeziefer verwandelt.
</fo:block>
<fo:block font-family="Arial Unicode
                    MS" font-size="17pt" text-decoration="underline" space-before="1em">
 vertical-align="0.2em" Als 
<fo:inline vertical-align="0.2em">
Gregor Samsa
</fo:inline>
 eines Morgens aus unruhigen Träumen erwachte, fand er sich in seinem Bett zu einem
                ungeheueren Ungeziefer verwandelt.
</fo:block>
</fo:block-container>
</fo:block-container>
</fo:flow>
</fo:page-sequence>
</fo:root>

Download the examples

In the output:

Excerpt from the W3C Recommendation:

More information online about

Property description in the CSS reference "vertical-align"

Rendering of the property in the XSL-FO reference

back to top