# CSS Inline Layout Module Level 3

## Editor’s Draft, 1 January 1970

Specification Metadata

This version:
  https://drafts.csswg.org/css-inline-3/
Latest published version:
  https://www.w3.org/TR/css-inline-3/
Previous Versions:
  https://www.w3.org/TR/2018/WD-css-inline-3-20180808/
  https://www.w3.org/TR/2016/WD-css-inline-3-20160524/
  https://www.w3.org/TR/2015/WD-css-inline-3-20150917/
  https://www.w3.org/TR/2014/WD-css-inline-3-20141218/
  https://www.w3.org/TR/2002/WD-css3-linebox-20020515/
Editors:
  Dave Cramer (Hachette Livre)
  Elika J. Etemad / fantasai (Invited Expert)
  Steve Zilles (Adobe)
Issue Tracking:
  GitHub Issues
Suggest an Edit for this Spec:
  GitHub Editor
Issues list:
  CSS3 Line Layout issues in GitHub

Copyright © 1970 W3C® (MIT, ERCIM, Keio, Beihang). W3C liability, trademark and permissive document license rules apply.

## Abstract

The CSS formatting model provides for a flow of elements and text inside of a container to be wrapped into lines. The formatting of elements and text within a line, its positioning in the inline progression direction, and the breaking of lines are described in [CSS-TEXT-3]. This module describes the positioning in the block progression direction both of elements and text within lines and of the lines themselves. This positioning is often relative to a baseline. It also describes special features for formatting of first lines and drop caps. It extends on the model in [CSS2].

CSS is a language for describing the rendering of structured documents (such as HTML and XML) on screen, on paper, etc.

## Status of this document

This is a public copy of the editors’ draft. It is provided for discussion only and may change at any moment. Its publication here does not imply endorsement of its contents by W3C. Don’t cite this document other than as work in progress.

GitHub Issues are preferred for discussion of this specification. When filing an issue, please put the text “css-inline” in the title, preferably like this: “[css-inline] …summary of comment…”. All issues and comments are archived, and there is also a historical archive.

This document was produced by the CSS Working Group.

This document was produced by a group operating under the W3C Patent Policy. W3C maintains a public list of any patent disclosures made in connection with the deliverables of the group; that page also includes instructions for disclosing a patent. An individual who has actual knowledge of a patent which the individual believes contains Essential Claim(s) must disclose the information in accordance with section 6 of the W3C Patent Policy.

This document is governed by the 1 March 2019 W3C Process Document.

The following features are at-risk, and may be dropped during the CR period:

- the initial-letters-wrap property

“At-risk” is a W3C Process term-of-art, and does not necessarily imply that the feature is in danger of being dropped or delayed. It means that the WG believes the feature may have difficulty being interoperably implemented in a timely manner, and marking it as such allows the WG to drop the feature if necessary when transitioning to the Proposed Rec stage, without having to publish a new Candidate Rec without the feature first.

## 1. Introduction

This module defines the CSS Inline Layout model, replacing and extending the model as defined in CSS2.1. It is very much a work-in-progress, and implementers should reference CSS2.1 for now.

Many aspects of layout here depend on font metrics. While the relevant metrics exist in OpenType for Latin/Cyrillic/Greek and for CJK, they are missing for many other writing systems. For example, the visual top metric for Hebrew has no metric in the OpenType tables. For this module to work well for the world, we need fonts to provide the relevant metrics for all writing systems, and that means both that OpenType needs to allow such metrics and font designers need to provide accurate numbers.

## 2. Inline Layout Box Model

A block container element that directly contains inline-level content—such as inline boxes, atomic inlines, and text runs—establishes an inline formatting context. The block container also generates a root inline box, which is an anonymous inline box that holds all of its inline-level contents. The root inline box inherits from its parent block container, but is otherwise unstyleable.

In an inline formatting context, content is laid out along the inline axis, ordered according to the Unicode bidirectional algorithm and its controls [CSS-WRITING-MODES-3] and distributed according to the typesetting controls in [CSS-TEXT-3]. Inline-axis margins, borders, and padding are respected between inline-level boxes (and their margins do not collapse). The rectangular area that contains the boxes that form a line of inline-level content is called a line box.

Note: Line boxes and inline boxes and inline-level boxes are each different things! See [CSS-DISPLAY-3] for an in-depth discussion of box types and related terminology.

Line boxes are created as needed to hold inline-level content within an inline formatting context. When an inline box exceeds the logical width of a line box, or contains a forced line break, it is split (see CSS Text 3 §5 Line Breaking and Word Boundaries) into several fragments [css-break-3], which are distributed across multiple line boxes. Like column boxes in multi-column layout [CSS-MULTICOL-1], line boxes are fragmentation containers generated by their formatting context, and are not part of the CSS box tree.

Note: Inline boxes can also be split into several fragments within the same line box due to bidirectional text processing. See [CSS-WRITING-MODES-3].

Line boxes are stacked as the direct contents of the block container box in the block flow direction and aligned within this container as specified by align-content [css-align-3]. Thus, an inline formatting context consists of a stack of line boxes. Line boxes are stacked with no separation (except as specified elsewhere, e.g. for float clearance) and they never overlap.

In general, the line-left edge of a line box touches the line-left edge of its containing block and the line-right edge touches the line-right edge of its containing block, and thus the logical width of a line box is equal to the inner logical width of its containing block (i.e. the block container’s content box). However, floating boxes or initial letter boxes can come between the containing block edge and the line box edge, reducing space available to, and thus the logical width, of any such impacted line boxes. (See CSS2§9.4.2/CSS2§9.5 and § 5 Initial Letters.)

Within the line box, inline-level boxes can be aligned along the block axis in different ways: their over or under edges can be aligned, or the baselines of text within them can be aligned. See vertical-align and its longhands. The logical height of a line box is fitted to its contents by the rules given in § 3.4 Line Sizing Containment: the line-sizing property.

Line boxes that contain no text, no preserved white space, no inline boxes with non-zero margins, padding, or borders, and no other in-flow content (such as atomic inlines or ruby annotations), and do not end with a preserved newline must be treated as zero-height line boxes for the purposes of determining the positions of any elements inside of them (such as absolutely positioned boxes), and must be treated as not existing for any other purpose (such as collapsing margins).

## 3. Line Heights and Baseline Alignment

This section is being rewritten. Refer to section 10.8 of [CSS2] for the normative CSS definition or the 2002 Working Draft if you want pretty pictures. (But ignore the old text, half of it’s wrong. We’re not specifying which half, that’s to be determined.) The CSS2 specification should be used as the guideline for implementation.

The CSSWG would like to know which baseline values are necessary: if any can be dropped, or any need to be added. See GitHub issue 859.

### 3.1. Dominant Baselines: the dominant-baseline property

Name: | dominant-baseline
Value: | auto | text-bottom | alphabetic | ideographic | middle | central | mathematical | hanging | text-top
Initial: | auto
Applies to: | block containers, inline boxes, table rows, table columns, grid containers, and flex containers
Inherited: | yes
Percentages: | N/A
Computed value: | specified keyword
Canonical order: | per grammar
Animation type: | discrete

This property specifies the dominant baseline, which is the baseline used to align the box’s text and inline-level contents. It is also indicates the default alignment baseline of any boxes participating in baseline alignment in the box’s alignment context. Values have the following meanings:

auto
  Equivalent to alphabetic in horizontal writing modes and in vertical writing modes when text-orientation is sideways, sideways-right, or sideways-left. Equivalent to central in vertical writing modes when text-orientation is mixed or upright.

  However, in SVG text, the origin point of glyphs (used for coordinate-based glyph positioning) is always handled as for central in vertical writing modes.

text-bottom
  Use the bottom of the em box as the baseline.
alphabetic
  Use the alphabetic baseline.
ideographic
  Match the box’s ideographic under-side baseline to that of its parent. This corresponds to the `ideo` baseline in OpenType.
middle
  Use the “middle” baseline: halfway between the alphabetic baseline and the ex-height.
central
  Use the central baseline (halfway between the ascent and descent).
mathematical
  Use the mathematical baseline.
hanging
  Use the hanging baseline.
text-top
  Use the top of the em box as the baseline.

See [CSS-WRITING-MODES-3] for an introduction to dominant baselines.

Should be text-over and text-under instead of text-top and text-bottom, but maybe it’s better not to use those terms for consistency with legacy vertical-align. See GitHub issue 860.

Add first and last values. Note, in this property, these are combinatorial, whereas in the align/justify-self/content properties, it’s singular. Do we want to align the syntaxes wrt hyphens vs. spaces or what? See GitHub issue 861.

### 3.2. Transverse Box Alignment: the vertical-align property

Name: | vertical-align
Value: | <'baseline-source'> || <'baseline-shift'> || <'alignment-baseline'>
Initial: | baseline
Applies to: | inline-level boxes
Inherited: | no
Percentages: | N/A
Computed value: | see individual properties
Animation type: | see individual properties
Canonical order: | per grammar

This shorthand property specifies how an inline-level box is aligned within the line. Values are the same as for its longhand properties, see below.

Authors should use this property (vertical-align) instead of its longhands (unless it is specifically needed to cascade its longhands independently).

#### 3.2.1. Alignment Baseline Source: the baseline-source longhand

Name: | baseline-source
Value: | auto | first | last
Initial: | auto
Applies to: | inline-level boxes
Inherited: | no
Percentages: | N/A
Computed value: | specified keyword
Canonical order: | per grammar
Animation type: | discrete

This is a rough draft, not ready for implementation. Also might rename stuff.

When an inline-level box has more than one possible source for baseline information (such as for a multi-line inline block or inline flex container) this property specifies whether the first baseline set or last baseline set is preferred for alignment. Values have the following meanings:

auto
  Specifies last-baseline alignment for inline-block, first-baseline alignment for everything else.
first
  Specifies first-baseline alignment.
last
  Specifies last-baseline alignment.

#### 3.2.2. Alignment Baseline Type: the alignment-baseline longhand

Name: | alignment-baseline
Value: | baseline | text-bottom | alphabetic | ideographic | middle | central | mathematical | text-top | bottom | center | top
Initial: | baseline
Applies to: | inline-level boxes, flex items, grid items, table cells
Inherited: | no
Percentages: | N/A
Computed value: | specified keyword
Canonical order: | per grammar
Animation type: | discrete

Specifies what point of an inline-level box is aligned to what point in the parent. Also selects the alignment baseline of boxes aligned with align-self/justify-self.

Clean up this prose to correctly handle alignment contexts other than inline formatting contexts.

Values are defined below:

For the following definitions, the margin box is used for atomic inlines, the leading box for non-replaced inlines, and the baselines of the box are synthesized if missing in the line-box’s inline axis:

baseline
  Use the dominant baseline choice of the parent. Match the box’s corresponding baseline to that of its parent.
text-bottom
  Match the bottom of the box to the bottom of the parent’s content area.
alphabetic
  Match the box’s alphabetic baseline to that of its parent.
ideographic
  Match the box’s ideographic character face under-side baseline to that of its parent.
middle
  Align the vertical midpoint of the box with the baseline of the parent box plus half the x-height of the parent.
central
  Match the box’s central baseline to the central baseline of its parent.
mathematical
  Match the box’s mathematical baseline to that of its parent.
text-top
  Match the top of the box to the top of the parent’s content area.

For the purposes of transverse alignment within a line box, an atomic inline that has no baseline sets uses baselines synthesized from its margin box.

For the following definitions, the alignment subtree is as defined in [CSS2].

top
  Align the top of the aligned subtree with the top of the line box.
center
  Align the center of the aligned subtree with the center of the line box.
bottom
  Align the bottom of the aligned subtree with the bottom of the line box.

SVG implementations may support the following aliases in order to support legacy content:

    text-before-edge = text-top
    text-after-edge = text-bottom

These values are not allowed in the vertical-align shorthand.

#### 3.2.3. Alignment Shift: the baseline-shift longhand

Name: | baseline-shift
Value: | <length-percentage> | sub | super
Initial: | 0
Applies to: | inline-level boxes, flex items, grid items
Inherited: | no
Percentages: | refer to the used value of line-height
Computed value: | the specified keyword and/or a computed <length-percentage> value
Canonical order: | per grammar
Animation type: | discrete

This property specifies by how much the box is shifted up from its alignment point. It does not apply when alignment-baseline is top or bottom.

Authors should use the vertical-align shorthand instead of this property.

Values have the following meanings:

<length>
  Raise (positive value) or lower (negative value) by the specified length.
<percentage>
  Raise (positive value) or lower (negative value) by the specified percentage of the line-height.
sub
  Lower by the offset appropriate for subscripts of the parent’s box. (The UA should use the parent’s font data to find this offset whenever possible.)
super
  Raise by the offset appropriate for superscripts of the parent’s box. (The UA should use the parent’s font data to find this offset whenever possible.)

User agents may additionally support the keyword baseline as computing to 0 if is necessary for them to support legacy SVG content.

We would prefer to remove the baseline value, and are looking for feedback from SVG user agents as to whether it’s necessary.

### 3.3. Line Spacing: the line-height property

As described in the section on inline formatting contexts , user agents flow inline-level boxes into a vertical stack of line boxes. The height of a line box is determined as follows:

1. The height of each inline-level box in the line box is calculated. For replaced elements, inline-block elements, and inline-table elements, this is the height of their margin box; for inline boxes, this is their line-height.
2. The inline-level boxes are aligned vertically according to their vertical-align property.

   In case they are aligned top or bottom, they must be aligned so as to minimize the line box height. If such boxes are tall enough, there are multiple solutions and CSS 2 does not define the position of the line box’s baseline (i.e., the position of the strut).

3. The line box height is the distance between the uppermost box top and the lowermost box bottom. (This includes the strut, as explained under line-height below.)

Empty inline elements generate empty inline boxes, but these boxes still have margins, padding, borders, and a line height, and thus influence these calculations just like elements with content.

#### 3.3.1. Leading and half-leading

CSS assumes that every font has font metrics that specify a characteristic height above the baseline and a depth below it. In this section we use A to mean that height (for a given font at a given size) and D the depth. We also define AD = A + D, the distance from the top to the bottom. (See the note below for how to find A and D for TrueType and OpenType fonts.) Note that these are metrics of the font as a whole and need not correspond to the ascender and descender of any individual glyph.

The User Agent must align the glyphs in a non-replaced inline box to each other by their relevant baselines. Then, for each glyph, determine the A and D. Note that glyphs in a single element may come from different fonts and thus need not all have the same A and D. If the inline box contains no glyphs at all, or if it contains only glyphs from fallback fonts, it is considered to contain a strut (an invisible glyph of zero width) with the A and D of the element’s first available font.

When the value of the line-height property is something other than normal, determine the leading L to add, where L = line-height - AD of the first available font. Half the leading is added above A of the first available font, and the other half below D of the first available font, giving a total height above the baseline of A' = A + L/2, and a total depth of D' = D + L/2. Glyphs from fonts other than the first available font do not impact the height or baseline of the inline box for line-height values other than normal.

Note: L may be negative.

Boxes of child elements do not influence this height.

When the value of the line-height property is normal, the height of the inline box encloses all glyphs, going from the highest A to the deepest D.

User Agents may use different sets of font metrics when determining A and D depending on whether the line-height property is normal or some other value, for instance taking external leading metrics into account only in the normal case.

Although margins, borders, and padding of non-replaced elements do not enter into the line box calculation, they are still rendered around inline boxes. This means that if the height specified by line-height is less than the content height of contained boxes, backgrounds and colors of padding and borders may "bleed" into adjoining line boxes. User agents should render the boxes in document order. This will cause the borders on subsequent lines to paint over the borders and text of previous lines.

Note: CSS 2 does not define what the content area of an inline box is (see § 4.1 Inline Box Heights: the inline-sizing property) and thus different UAs may draw the backgrounds and borders in different places.

Note: It is recommended that implementations that use OpenType or TrueType fonts use the metrics `sTypoAscender` and `sTypoDescender` from the font’s OS/2 table for A and D (after scaling to the current element’s font size). In the absence of these metrics, the "Ascent" and "Descent" metrics from the HHEA table should be used.

Name: | line-height
Value: | normal | <number> | <length-percentage>
Initial: | normal
Applies to: | inline boxes
Inherited: | yes
Percentages: | computed relative to 1em
Computed value: | the specified keyword, a number, or a computed <length> value
Canonical order: | per grammar
Animation type: | discrete

On a block container whose content is composed of inline-level boxes, line-height specifies the minimal height of line boxes within the element. The minimum height consists of a minimum height above the baseline and a minimum depth below it, exactly as if each line box starts with a zero-width inline box with the element’s font and line height properties. We call that imaginary box a strut. (The name is inspired by TeX.).

The height and depth of the font above and below the baseline are assumed to be metrics that are contained in the font.

On a non-replaced inline box, line-height specifies the height that is used in the calculation of the line box height.

Values for this property have the following meanings:

normal
  Tells user agents to determine the height of the inline box automatically based on font metrics. See above for details.
<length>
  The specified length is used in the calculation of the line box height. Negative values are illegal.
<number>
  The used value of the property is this number multiplied by the element’s font size. Negative values are illegal. The computed value is the same as the specified value.
<percentage>
  The computed value of the property is this percentage multiplied by the element’s computed font-size. Negative values are illegal.

The three rules in the example below have the same resultant line height:

    div { line-height: 1.2; font-size: 10pt }     /* number */
    div { line-height: 1.2em; font-size: 10pt }   /* length */
    div { line-height: 120%; font-size: 10pt }    /* percentage */

Note: When there is only one value of line-height (other than normal) for all inline boxes in a block container box and they all use the same first available font (and there are no replaced elements, inline-block elements, etc.), the above will ensure that baselines of successive lines are exactly line-height apart. This is important when columns of text in different fonts have to be aligned, for example in a table.

The fact that percentages compute to lengths is annoying. See also href="https://github.com/w3c/csswg-drafts/issues/3118">Issue 3118 and Issue 2165.

### 3.4. Line Sizing Containment: the line-sizing property

Name: | line-sizing
Value: | legacy | normal
Initial: | legacy
Applies to: | inline boxes
Inherited: | yes
Percentages: | N/A
Computed value: | the specified keyword
Canonical order: | per grammar
Animation type: | discrete

This is a rought draft of a proposal, and has not yet been approved by the CSSWG. See discussion in Issue 3199, Hyatt’s message, and dbaron’s proposal.

This property controls the method by which line boxes are sized, and thus the spacing between lines of text.

Values have the following meanings:

legacy
  The inline box contributes to the sizing of its line box based on its line-height, rather than based on its box edges, as defined in [CSS2]. In Quirks Mode [QUIRKS], any inline box fragment that has zero borders and padding and that does not directly contain text or preserved white space [CSS-TEXT-3] is ignored when sizing the line box.

  Note: In this model, vertical rhythm is broken any time there is a change in font metrics within a paragraph.

normal
  The inline box contributes to the sizing of its line box based on its margin box, rather than its line-height. Half-leading is inserted inside the content box edges, rather than overlapping the padding/border/margin areas. However, positive half-leading is only applied to the root inline box. Negative half-leading is applied to all inline boxes,- reducing the size of the content box as needed.

  Note: This will give consistent line spacing as long as there is some amount of leading added, such that the half-leading on the root inline is large enough to accommodate the unleaded ascent/descent of its descendants. The line box will grow, however, to accommodate content that would otherwise overflow, to avoid overlap between lines.

Should this property apply to block containers or to inline boxes? In the latter case, an individual inline could say "pay attention to me" or "don’t pay attention to me".

### 3.5. Leading Control: the leading-trim-over and leading-trim-under properties and leading-trim shorthand

This is a rought draft of a proposal, and is likely to change significantly as design critiques and use cases are registered. Values and property names may be added, dropped, and/or renamed, and the overall syntax or behavior may change. Do not implement (yet). The CSSWG particularly invites feedback on which font metrics need corresponding keyword values.

To ensure consistent spacing in the basic case of running text, CSS line layout introduces leading both above and below the text content of each line. In addition, the ascend and descent font metrics themselves include extra space above and below the most common glyph sizes in order to accommodate occasional characters and diacritics which ascend or descend beyond the typical bounds. This prevents subsequent lines of text from overlapping each other. However, all this extra spacing interferes with visual alignment and with control over effective (visually-apparent) spacing.

The leading-trim properties allow controlling the spacing above and below the first and last lines of a block. It allows precise control over spacing; moreover, by relying on font metrics rather than hard-coded lengths, it allows content to be resized, rewrapped, and rendered in a variety of fonts while maintaining that spacing.

A common problem is vertical centering. It’s easy to vertically center the text container to an icon, but because the visual boundaries of Latin text are the cap height and the alphabetic baseline, rather than the ascent and descent, this often doesn’t yield the intended visual effect.

Measuring to the top/bottom of the text may yield equal results, but measuring to the visual bounds shows that it is not visually centered.

To center the text visually, it’s necessary to asume the cap height and alphabetic baseline as the top and bottom edges of the text, respectively.

Measuring to the cap height / alphabetic baseline instead of the ascent / descent and equalizing those distances visually centers the text.

By using leading-trim to strip out the spacing above the cap height and below the alphabetic baseline, centering the box actually centers the text; and does so reliably, regardless of what font is used to render it.

Even though different fonts have different cap heights, by using the font’s metric rather than a magic number, the layout intention is met even as the font is changed.

Name: | leading-trim-over
Value: | normal | text | cap | ex | ideographic | ideographic-ink
Initial: | normal
Applies to: | block containers
Inherited: | no
Percentages: | N/A
Computed value: | the specified keyword
Canonical order: | per grammar
Animation type: | discrete

The leading-trim-over property trims the line-over side of the first line box in the block container to better match the box’s content edge to its text content. The property affects only the first formatted line of the block container; if there is no such line, it has no effect. Values have the following meanings:

normal
  Half-leading is applied over the first line, just as for every other line.
text
  Half-leading is not applied over the first line; the top of the line box is set to the text-top metric of the root inline box.
cap
  Half-leading is not applied over the first line; the top of the line box is set to the cap-height metric of the root inline box.
ex
  Half-leading is not applied over the first line; the top of the line box is set to the ex-height metric of the root inline box.
ideographic
  Half-leading is not applied over the first line; the top of the line box is set to the ideographic top (`idtp`) metric of the root inline box.
ideographic-ink
  Half-leading is not applied over the first line; the top of the line box is set to the ideographic character face top (`icft`) metric of the root inline box.

Name: | leading-trim-under
Value: | normal | text | alphabetic | ideographic | ideographic-ink
Initial: | normal
Applies to: | block containers
Inherited: | yes
Percentages: | N/A
Computed value: | the specified keyword
Canonical order: | per grammar
Animation type: | discrete

The leading-trim-over property trims the line-over side of the first line box in the block container to better match the box’s content edge to its text content. The property affects only the first formatted line of the block container; if there is no such line, it has no effect. Values have the following meanings:

normal
  Half-leading is applied over the first line, just as for every other line.
text
  Half-leading is not applied over the first line; the top of the line box is set to the text-top metric of the root inline box.
alphabetic
  Half-leading is not applied over the first line; the top of the line box is set to the alphabetic baseline metric of the root inline box.
ideographic
  Half-leading is not applied over the first line; the top of the line box is set to the ideographic bottom (`ideo`) metric of the root inline box.
ideographic-ink
  Half-leading is not applied over the first line; the top of the line box is set to the ideographic character face top (`icfb`) metric of the root inline box.

Name: | leading-trim
Value: | normal | text | cap | ex | ideographic | ideographic-ink
Initial: | normal
Applies to: | block containers
Inherited: | no
Percentages: | N/A
Computed value: | the specified keyword
Canonical order: | per grammar
Animation type: | discrete

This property is a shorthand of leading-trim-over and leading-trim-under. If cap or ex is specified, leading-trim-over is set to that value and leading-trim-under is set to alphabetic; otherwise both longhands are set to the specified keyword.

## 4. Drawing Inline Boxes

### 4.1. Inline Box Heights: the inline-sizing property

Name: | inline-sizing
Value: | normal | stretch
Initial: | normal
Applies to: | inline boxes
Inherited: | no
Percentages: | n/a
Computed value: | specified keyword
Canonical order: | per grammar
Animation type: | discrete

This property specifies how the logical height of the content area of an inline box is measured and how it is aligned with its contents. (It has no effect on the size or position of the box’s contents.) Values have the following meanings:

normal
  The content area of the inline box is sized and position to fit its (possibly hypothetical) text as specified in CSS2§10.6.1.
stretch
  Once the line box has been sized, the final logical height of the inline box’s content area is calculated as the stretch fit into the line box, and it is positioned such that its margin edges coincide with the line box’s edges.

We might want to use this opportunity to more precisely define normal, rename it to match, and possibly introduce any other values that may seem necessary.

The height property does not apply. The height of the content area should be based on the font, but this specification does not specify how. A UA may, e.g., use the the maximum ascender and descender of the font. (This would ensure that glyphs with parts above or below the em-box still fall within the content area, but leads to differently sized boxes for different fonts.)

The vertical padding, border and margin of an inline, non-replaced box start at the top and bottom of the content area, and has nothing to do with the line-height. But only the line-height is used when calculating the height of the line box.

If more than one font is used (this could happen when glyphs are found in different fonts), the height of the content area is not affected by the glyphs from the fallback fonts, and only depends on the first available font.

## 5. Initial Letters

The editors would appreciate any examples of drop initials in non-western scripts, especially Arabic and Indic scripts.

### 5.1. An Introduction to Initial Letters

This section is non-normative.

Large, decorative letters have been used to start new sections of text since before the invention of printing. In fact, their use predates lowercase letters entirely.

#### 5.1.1. Drop Initial

A dropped initial (or “drop cap”) is a larger-than-usual letter at the start of a paragraph, with a baseline at least one line lower than the first baseline of the paragraph. The size of the drop initial is usually indicated by how many lines it occupies. Two- and three-line drop initials are very common.

Three-line drop initial with E acute. Since the cap-height of the drop initial aligns with the cap-height of the main text, the accent extends above the paragraph.

The exact size and position of a dropped initial depends on the alignment of its glyph. Reference points on the drop cap must align precisely with reference points in the text. The alignment constraints for drop initials depend on the writing system.

In Western scripts, the top reference points are the cap height of the initial letter and of the first line of text. The bottom reference points are the alphabetic baseline of the initial letter and the baseline of the Nth line of text. The figure below shows a simple two-line drop cap, with the relevant reference lines marked.

Two-line drop cap showing baselines (green lines), cap-height (red line), and ascender (cyan line).

In Han-derived scripts, the initial letter extends from the block-start edge of the glyphs on the first line to the block-end edge of the glyphs on the Nth line.

Two-line drop initial in vertical writing mode

In certain Indic scripts, the top alignment point is the hanging baseline, and the bottom alignment point is the text-after-edge.

Devangari initial letter aligned with hanging baseline. Alignment points shown in red.

#### 5.1.2. Sunken Initial Letters

Some styles of drop initials do not align with the first line of text. A sunken initial (or “sunken cap”) both sinks below the first baseline, and extends above the first line of text.

Sunken cap. The letter drops two lines, but is the size of a three-line initial letter.

#### 5.1.3. Raised Initial Letters

A raised initial (often called a “raised cap” or “stick-up cap”) “sinks” to the first text baseline.

Note: A proper raised initial has several advantages over simply increasing the font size of a first letter. The line spacing in the rest of the paragraph will not be altered, but text will still be excluded around large descenders. And if the size of raised initial is defined to be an integral number of lines, implicit baseline grids can be maintained.

Raised cap. The initial letter is the size of a 3-line initial, but does not drop.

### 5.2. Selecting Initial Letters

This section is non-normative.

Initial letters are typically a single letter, although they may include punctuation or a sequence of characters which are perceived by the user to be a single typographic unit. The ::first-letter pseudo-element, defined in [SELECT] and [CSS-PSEUDO-4], can be used to select the character(s) to be formatted as initial letters.

Authors who need more control over which characters are included in an initial letter, or who want to apply initial-letters formatting to replaced elements or multiple words can alternately apply the initial-letters property to the first inline-level child of a block container.

    <p>This paragraph has a dropped “T”.
    <p><img alt="H" src="illuminated-h.svg">ere we have an illuminated “H”.
    <p><span>Words may also</span> be given initial letter styling at the beginning of a paragraph.

    ::first-letter, /* style first paragraph’s T */
    img, /* style illuminated H */
    span /* style phrase inside span */
    { initial-letters: 2; }

Note that since ::first-letter selects punctuation before or after the first letter, these characters are included in the initial-letters when ::first-letter is used.

The ::first-letter pseudo-element selects the quotation mark as well as the “M”.

Should there be a way to opt out of this behavior? See Github Issue 310.

### 5.3. Creating Initial Letters: the initial-letters property

Name: | initial-letters
Value: | normal | <number> <integer> | <number> && [ drop | raise ]?
Initial: | normal
Applies to: | certain inline-level boxes and ::first-letter and inside ::marker boxes (see prose)
Inherited: | no
Percentages: | N/A
Computed value: | the keyword normal or a number paired with an integer
Canonical order: | per grammar
Animation type: | by computed value type

Renaming this property (and the others in this section) is currently under discussion.

This property specifies the size and sink for dropped, raised, and sunken initial letters as the number of lines spanned.

For example, the following code will create a 2-line dropped initial letter at the beginning of each paragraph that immediately follows a second-level heading:

    h2 + p::first-letter { initial-letters: 2; }

It takes the following values:

normal
  No special initial-letters effect. Text behaves as normal.
<number>
  This first argument defines the size of the initial letter in terms of how many lines it occupies. Values less than one are invalid.
<integer>
  This optional second argument defines the number of lines the initial letter should sink. A value of 1 indicates a raised initial; values greater than 1 indiciate a sunken initial. Values less than one are invalid.
raise
  Computes to an initial letter sink of 1.
drop
  Computes to an initial letter sink equal to the initial letter size floored to the nearest positive whole number.

If the initial letter sink value is omitted, drop is assumed.

Values other than normal cause the affected box to become an initial letter box, which is an in-flow inline-level box with special layout behavior.

Here are some examples of initial-letters usage:

initial-letters: 3
initial-letters: 3 3
initial-letters: 3 drop
initial-letters: drop 3
  Represents a dropped initial 3 lines high, 3 lines deep.

initial-letters: 3 2
  Represents a sunken initial 3 lines high, 2 lines deep.

initial-letters: 3 1
initial-letters: 3 raise
initial-letters: raise 3
  Represents a raised initial 3 lines high, 1 line deep.

initial-letters: 2.51 3
  The size of the initial letter does not have to be an integral number of lines. In this case only the bottom aligns.

In conjunction with other CSS properties, initial-letters can be used to create “adjacent initial letters,” where the initial letter is adjacent to the text:

    p::first-letter {
      initial-letters: 3;
      color: red;
      width: 5em;
      text-align: right;
      margin-left: -5em;
    }

    p {
      margin-left: 5em;
    }

#### 5.3.1. Applicability

To give authors more control over which characters can be styled as an initial letter and to allow the possibility of multi-character initial letters (such as for first word or first phrase styling), the initial-letters property applies not just to the CSS-defined ::first-letter pseudo-element, but also to inside-positioned ::marker pseudo-elements and inline-level boxes that are placed at the start of the first line. Specifically, initial-letters applies to any inline-level box—including any such ::first-letter or ::marker box—that is the first child of its parent box and whose ancestors (if any) that are descendants of its containing block are all first-child inline boxes that have a computed initial-letters value of normal.

For example, the `<span>`, `<em>`, and `<b>` elements in the following example are "first-most inline-level descendants" of the `<p>`, but the `<strong>` element is not:

    <p><span><em><b>This</b> phrase</em> is styled
    <strong>specially</strong>.</span> …

If we apply the following rules:

    em { initial-letters: 2; }
    b, strong { initial-letters: 3; }

The initial-letters property will take effect only on the `<em>`. The styling on `<b>` is ignored, as it has an ancestor already styled as an initial letter; and the styling on `<strong>` is ignored because it is a second sibling.

The result might be rendered as

If initial-letters is applied to an inline-level box that is not positioned at the start of the line due to bidi reordering or which is otherwise preceded by other inline-level content, its used value is normal, and it is not formatted as an initial letter.

The effect of the initial-letters property is undefined on children of ruby base container boxes and on ruby container boxes.

Note: The initial-letters property cannot apply to any element whose float is not none or position is not static, because these values cause its display to compute to block.

### 5.4. Alignment of Initial Letters: the initial-letters-align property

As mentioned earlier, the alignment of initial letters depends on the script used. The initial-letters-align property can be used to specify the proper alignment.

Name: | initial-letters-align
Value: | border-box? [ alphabetic | ideographic | hebrew | hanging ] | border-box
Initial: | alphabetic
Applies to: | certain inline-level boxes and ::first-letter and inside ::marker boxes (see prose)
Inherited: | yes
Percentages: | N/A
Computed value: | specified keyword(s)
Canonical order: | per grammar
Animation type: | discrete

This property specifies the alignment points used to size and position an initial letter. Two sets of alignment points are necessary: the over and under alignment points of the initial letter are matched to corresponding over and under points of the surrounding text.

Values have the following meanings:

alphabetic
  Use the cap-height and alphabetic baselines of the surrounding text to align the initial letter.
ideographic
  Use the ideographic character face top and bottom edge baselines of the surrounding text to align the initial letter.
hebrew
  Use the Hebrew top and alphabetic baseline of the surrounding text to align the initial letter.
hanging
  Use the hanging and alphabetic baselines of the surrounding text to align the initial letter.
border-box
  Use the initial letter box’s line-under and line-over border edges as the over and under alignment points, respectively.

Is there a proper typographic term for the hebrew “hanging” baseline?

The vertical writing mode example earlier (in § 5.1 An Introduction to Initial Letters) could be coded as:

    span.initial {
      initial-letters: 2;
      initial-letters-align: ideographic;
    }

Initial letter in Hebrew

    span.initial {
    initial-letters: 2;
    initial-letters-align: hebrew;
    }

Except when border-box is specified, the alignment points of the initial letter are automatically determined from its contents:

1. If the initial letter is an atomic inline, use its over and under content-box edges.
2. Else if the initial letter contains any character from the Han, Hangul, Kana, or Yi Unicode scripts, use the ideographic character face top and bottom edge baselines.
3. Else if the initial letter contains any character from the Devanagari, Bengali, and Gurmukhi Unicode scripts, use the hanging and alphabetic baselines.
4. Else if the initial letter contains any character from the Hebrew Unicode scripts, use the Hebrew top and alphabetic baselines.
5. Else use the cap-height and alphabetic baselines.

What is the proper alignment for South Asian scripts that do not have the explicit hanging baseline, such as Tamil or Telugu? See GitHub issue 864

Note: The ordering of keywords in this property is fixed in case border-box is expanded to [ border-box | alphabetic | ideographic | hebrew | hanging ] to allow explicitly specifying the initial letter’s alignment points.

#### 5.4.1. UA Default Stylesheet for initial-letters-align

In order to provide the better behavior by default, UAs must include in their default UA style sheet the following rules:

    [lang]:lang(zh, ja, ko, ii) {
      initial-letters-align: ideographic;
    }
    [lang]:lang(iw, yi, lad, jrb) {
      initial-letters-align: hebrew;
    }
    [lang]:lang(hi, mr, ne, pi, kok, brx, mai, sd, sa) {
      initial-letters-align: hanging;
    }
    /* Script tags override language tags */
    [lang]:lang('*-Latn', '*-Cyrl') {
      initial-letters-align: alphabetic;
    }
    [lang]:lang('*-Hani', '*-Hant', '*-Hans') {
      initial-letters-align: ideographic;
    }

This only covers the most common cross-linguistic transcription systems. Should we include any other / all script tags in the UA style sheet?

### 5.5. Initial Letter Layout

There are two types of initial letter boxes: those that arise from non-replaced inline boxes and those that arise from atomic inlines.

For the non-atomic inline initial letter, the box and its contents participate in the same inline formatting context as the line on which it occurs, and a lot of special rules apply to give the expected sizing and alignment.

For an atomic initial letter, however, which is either a replaced element or which establishes an independent formatting context for its contents, the sizing of the box (aside from its automatic size in the block axis) and layout of the contents within the box follows the usual rules: it is primarily the positioning of the box which is special.

#### 5.5.1. Properties Applying to Initial Letters

All properties that apply to an inline box also apply to an inline initial letter except for vertical-align and its sub-properties, font-size, line-height, line-sizing, and inline-sizing. Additionally, all of the sizing properties and box-sizing also apply to initial letters, (see [css-sizing-3]).

All properties that apply to an atomic inline also apply to the atomic inline when styled as an initial letter, except for vertical-align and its sub-properties.

#### 5.5.2. Margins, Borders, and Padding

Initial letters can be styled with margins, padding, and borders just like any other box. Unless initial-letters-align is border-box, its vertical alignment and sizing are not affected; however the effective exclusion area is (and corresponds to the margin area).

Reword that to handle box-sizing correctly.

When padding and borders are zero, the initial letter may be kerned; see below.

### 5.6. Font Sizing of Initial Letters

For an inline initial letter, the font size used for sizing the initial letter contents is calculated to fulfill its specified size (see initial-letters) as anchored by its specified alignment points (see initial-letters-align). Note that no layout is required in this calculation: it is based only on computed values and font metrics. These used font size calculations do not affect the computed font-size, and therefore have no effect on the computation of em length values, etc.

What about inheritance to descendants?

For an atomic initial letter, the used font size is the computed font size as usual.

The line height used in these calculations is the line-height of the containing block (or, in the case where a baseline grid is in use, the baseline-to-baseline spacing required by the baseline grid [CSS-LINE-GRID-1]). The contents of the lines spanned, and therefore any variation in their heights and positions, is not accounted for.

For an N-line drop initial in a Western script, the cap-height of the letter needs to be (N – 1) times the line-height, plus the cap-height of the surrounding text. Note this height is not the font size of the drop initial.

Actually calculating this font size is tricky. For an N-line drop initial, we find the drop initial font size to be:

Update this calculation to be a) generic across writing systems / alignment points and b) handle non-integer sizes.

A three-line drop initial in Adobe Minion Pro would have a font size of 61.2pt given 12pt text, 16pt line-height, and a cap-height of 651/1000 (from the font’s OS/2 table).

#### 5.6.1. Shaping and Glyph Selection

When initial-letters is not normal, shaping should still occur across an inline initial letter box’s boundaries. (See CSS Text 3 §7.3 Shaping Across Element Boundaries.) For example, if the first letter of the Farsi word “پس” were styled with initial-letters: 2 1, both letters would be styled in their joined forms, with initial-form “ﭘ” as the initial letter, followed by the normally-styled final-form “ﺲ”. Note that the two letters might not always graphically connect, even when shaped in their joining forms.

Are there other things we need to consider here?

### 5.7. Sizing the Initial Letter Box

For an inline initial letter, if the initial letter’s preferred width/preferred height is definite, use that value (clamped as required by the min size and max size properties, and handling box-sizing as required) for that dimension of the box.

Otherwise it is considered to have an automatic size in that dimension and is sized and positioned to coincide with the smallest rectangle that would include the bounding boxes of all its glyphs—excluding any that hang (see hanging-punctuation)—as well as the margin boxes of any atomic inlines it contains.

Should the hanging punctuation be included in the box instead (so that the box is drawn around the punctuation when it is made visible through borders/background), but rather only excluded when positioning the box (so that the initial letter remains flush, with the hanging punctuation properly hanging)? See discussion.

For atomic initial letters, sizing follows the usual rules for that type of atomic inline. However, if the box has an automatic block size (auto), then its block size is determined as for an inline initial letter with border-box alignment, and is definite.

#### 5.7.1. Alignment Within an Initial Letter Box

By default (i.e. under automatic sizing), the content box of an inline initial letter is fitted exactly to its content, and alignment properties like text-align or align-content do not apply. However, if the box is not sized automatically:

- If the inline size is definite, text-align is honored for aligning the contents of the initial letter within its box in the inline axis (using its inline-axis bearings as usual, not the bounding box of its glyph outlines).
- If the block size is definite, align-content is honored for aligning its contents in the block axis (using its block-axis bearings, synthesizing them if needed).

### 5.8. Initial Letter Positioning and Spacing

#### 5.8.1. Space Below Initial Letters

The glyph(s) of an initial letter do not always fit within the specified sink. For example, if an initial letter has a descender, it could crash into the (n+1)th line of text. This is not desirable.

Incorrect: three-line initial letter with descender. In this font, the capital “J” extends well below the baseline (shown in red).

Therefore all line boxes impacted by the glyph bounding boxes of an initial letter are excluded, not just those within range of the initial letter sink. Specifically, for non-atomic initial letters, the content box of the element is sized to fit:

- The specified amount of sink (i.e the distance from the top alignment point to the bottom alignment point).
- The actual ascent and descent and side bearings of all the glyphs it contains that are part of its inline formatting context, even if they leak outside their em boxes.
- The margin boxes of all the atomic inlines it contains that are part of its inline formatting context, even if they leak outside its own line-height.

The initial letter is then made an exclusion area, the same as if it were a float. See initial-letters-wrap for details.

Correct: text excluded around glyph bounding box

#### 5.8.2. Block-axis Positioning

In the block axis, the initial letter is positioned as required to satisfy its under alignment point (initial-letters-align) at its specified sink (initial-letters), i.e. it is positioned such that it would sink the number of lines specified by initial-letters’s second argument and align to the requisite under alignment point if it was assumed that its containing block held only the initial letter itself followed by an infinite sequence of plain text as the direct contents of its root inline box.

Its position is anchored with respect to the line on which it occurs.

#### 5.8.3. Inline Positioning and Kerning

In the inline axis, the position of the inline letter is given by matching its inline-start margin edge with the inline-start edge of the line box.

However, if the initial letter is a non-atomic inline with an automatic inline size and zero padding and borders, it is negatively offset by the distance from the start edge of its content box to the point in the content that would have been placed at the start edge of the containing block if it were not an initial letter (i.e. the distance between its glyph bounding box and its start side bearing).

### 5.9. Initial Letter Wrapping: the initial-letters-wrap property

Note: initial-letters-wrap is at risk.

Name: | initial-letters-wrap
Value: | none | first | all | grid | <length-percentage>
Initial: | none
Applies to: | certain inline-level boxes and ::first-letter and inside ::marker boxes (see prose)
Inherited: | yes
Percentages: | relative to logical width of (last fragment of) initial letter
Computed value: | specified keyword or computed <length-percentage> value
Canonical order: | per grammar
Animation type: | by computed value type

This property specifies whether lines impacted by an initial letter are shortened to fit the rectangular shape of the initial letter box or follow the contour of its end-edge glyph outline.

none
  No contour-fitting is performed: each impacted line is aligned flush to the end margin edge of the initial letter.
first
  Behaves as none if the first typographic character unit after the initial letter belongs to Unicode General Category Zs. Otherwise behaves as for all on the first line of the block containing the initial letter and as none on the rest.
  This example shows why contour-fitting the first line is necessary, and why it is dropped when the initial letter is followed by a space:
  In the top paragraph, the initial letter "A" has a word space after it: the gap between the top of the "A" and the next letter provides the necessary word separation. In the next paragraph, the initial letter "A" is part of the first word, and leaving a gap between the top of the "A" and the next letter would create a jarring visual break within the word. In this case, the first line of text should be kerned into the initial letter’s area, as shown in the bottom paragraph.

  Do we need an unconditional first? (I.e. Should we rename this value to auto and add a first value that does not check for spaces?) See GitHub issue 410

all
  For each line of text impacted by the initial letter, the line box adjacent to the initial letter starts at the start-most point that touches the ink of the initial letter, plus the amount of the initial letter’s end-side border+padding+margin.

  If the value of shape-outside is not none, shape-outside is used instead of the glyph outline.

  Note: This value is at-risk.

grid
  This value is the same as none, except that the exclusion area of the impacted lines is increased as necessary for its end-edge to land on the character grid, i.e. to be a multiple of (1ic + letter-spacing) as computed on the containing block. The justify-self property can then be used to align the initial letter box within the exclusion area.
  Diagram of Japanese initial letter in vertical writing mode

  Note: In this example, the exclusion area for the drop initial is larger than its glyph in order to preserve inline-axis alignment.

  Note: This value is also at-risk.

<length>
<percentage>
  This value behaves the same as first except that the adjustment to the first line is given explicitly instead of being inferred from the glyph shape.

  This really needs font-relative lengths to be relative to the used size.

  Note: This value exists because it is easier to implement. Authors are encouraged to use the first value and to set margins to control spacing, and to use this as a fallback for glyph detection if necessary.

  In the following example, UAs that support first will use the glyph outline plus the specified margin in order to place the first line, whereas UAs that only support <length> or <percentage> values will pull in the first line by 40% of the initial letter’s width (and then add the margin to that point).

      h1 + p:first-letter {
        initial-letters: 3; /* 3-line drop-cap */
        initial-letters-wrap: first;
        margin-right: 0.1em;
      }
      @supports (not (initial-letters-wrap: first)) {
        /* Classes auto-generated on paragraphs to match first letter. */
        p.A:first-letter {
          initial-letters-wrap: -40%; /* Start of glyph outline, assuming correct font. */
        }
      }

  These values and related annoyance is likely unnecessary if someone submits a patch to Blink to support first.

Edit figure to show how auto behaves in varying contexts

    p::first-letter {
      initial-letters: 3;
      initial-letters-wrap: none;
    }

Ordinary initial letter with no wrapping.

    p::first-letter {
      initial-letters: 3;
      initial-letters-wrap: all;
    }

Text follows shape of initial letter. Each line box should just touch the ink of the letter, with some offset (represented by the shaded box).

    p::first-letter {
      initial-letters: 3;
      initial-letters-wrap: first;
    }

Only the first line is moved up against the ink of the initial letter.

    p::first-letter {
      initial-letters: 3;
      initial-letters-wrap: all;
    }

### 5.10. Line Layout

An initial letter box is considered in-flow in its block formatting context, and is part of the contents of the line box in which it originates. Aside from vertical alignment, its interaction with the rest of the contents of the line is as normal, except in a few specific circumstances…

#### 5.10.1. Inline Flow Layout: Alignment and Justification

For a raised initial no special consideration is given for alignment and justification: it is treated similar to any other inline-level content.

However, for a sunken initial its inline-start edge is anchored to the inline-start edge of the line box (after indentation) and text alignment affects the remaining content of the line in the remaining space, without moving the initial letter box itself.

Note: The CSSWG was not aware of any reasonable use cases for mixing non-start text alignment with dropped initial letters, and this was the most sensible behavior proposed. This behavior may be reconsidered if use cases require otherwise.

In addition, to ensure consistent alignment of all the impacted lines, any letter-spacing or justification opportunity that would normally be introduced by the juxtaposition of the contents of a sunken initial and the subsequent contents of the line is suppressed. (Note that this does not affect word-spacing or the justification opportunity introduced by a word separator because that space is provided by the typographic character unit alone and not by its juxtaposition with an adjacent character.)

#### 5.10.2. Edge Effects: Indentation and Hanging Punctuation

text-indent and hanging-punctuation apply to the first line of text as normal in the presence of initial letters. Lines affected by the exclusion are shortened, as in the presence of floats, and are affected the same way.

Initial letter with text indent.

The interaction of initial-letters and hanging-punctuation is under discussion.

#### 5.10.3. Ancestor Inlines

If the initial letter box is contained by inline box ancestors, the boundaries of those inline boxes are drawn to exclude the initial letter box, as if it were outside their startmost margin edge. This is a purely geometric operation: it does not affect e.g. property inheritance or the effective letter-spacing between the initial letter box and subsequent content.

#### 5.10.4. Multi-line Initial Letters

If an initial letter is too long to fit on one line, it wraps (according to the usual text-wrapping rules), each line filled and formatted exactly as if it were the first line and the initial letter too long to fit any subsequent normal text. Any normal text after the initial letter starts on its last line, affected exactly as if that line were the first line.

Drop cap extends to two lines.

### 5.11. Clearing Initial Letters

#### 5.11.1. Raised and sunken caps

The margin box of an initial letter contributes to the size of its containing element. Initial letters that extend above the first line of text, known as “raised caps” or “sunken caps,” do not extend up into previous elements. Since the content box for an initial letter includes all glyph ink, this also means that accents or other ink above the cap height of an initial letter will not impinge on previous elements.

Raised cap (`initial-letters: 3 1`) on right; note that the position of the “C” is the same in both cases, but on the right all text is moved down relative to the initial letter.

Handle glyph ink above cap height of font. Proposal: Make it an exclusion area for line boxes and border boxes. Include margin specified on initial-letters as part of exclusion area in order to control spacing.

Draw a box model diagram here. Does the margin of the initial letter collapse with its container?

#### 5.11.2. Short paragraphs with initial letters

A paragraph with an initial letter can have fewer lines of text than the initial letter occupies. In this case, the initial letter’s top alignment is still honored, and its exclusion area continues into any subsequent blocks. This forces the subsequent inline-level content to wrap around the initial letter—exactly as if that block’s text were part of its own containing block. (This is similar to how floats exclude content in subsequent block boxes.)

The red text is a short paragraph with an initial letter. Note the subsequent paragraph wraps around the initial letter just as text in the paragraph with the initial letter does.

If the subsequent block starts with an initial letter, establishes an independent formatting context, or specifies clear in the initial letter’s containing block’s start direction, then it must clear the previous block’s initial letter.

The red text is a short paragraph with an initial letter. The subsequent paragraph clears because it also has an initial letter.

#### 5.11.3. Interaction with floats

Initial letters are not floats: they are in-flow inline-level content that belongs to a line box. Therefore:

- The clear property does not care about initial letters: it neither applies to initial letters nor clears them when applied to nearby floats.
- Like line boxes or floats, initial letter boxes must not overlap the margin boxes of any floats participating in the same block formatting context. An overlapping initial letter box is shifted inward or downward until either it fits without overlapping or there are no more floats present.
- If a line box’s start edge shifts or moves down to clear a float, an initial letter originating in it moves with it; likewise if an initial letter shifts inward or moves downward to clear a float, its originating line box and subsequent line boxes shorten and/or move accordingly.
- If an inline-start float originates in the first line of content adjacent to an initial letter, then it moves past the initial letter towards the containing block edge, exactly as if the initial letter were any other inline-level content.

  However, if such a float originates in subsequent lines of content adjacent to a (sunk) initial letter, then that float must clear the initial letter.

In the absence of an initial letter, the first line of text could abut the blue float. But the presence of the initial letter requires that the text move over.

See CSS2§9.5 for more information about the layout of floats and adjacent content. [CSS2]

Whether an inline-end float originating in subsequent lines must clear the initial letter (as inline-start floats do) is still under discussion. There is no aesthetic reason to require it; however it’s yet unclear how the underlying layout model would distinguish between the two cases.

#### 5.11.4. Interaction with Fragmentation (Pagination)

Since a single glyph cannot be fragmented across pages (or columns or other fragmentation containers), an initial letter is considered monolithic [css-break-3] for the purpose of block-axis fragmentation (breaking across pages, columns, regions, etc.). Additionally, breaks between the in-flow lines alongside an initial letter box are avoided, much as breaks between line boxes affected be widows and orphans are avoided. However, if there is a forced break alongside the initial letter box, then it takes precedence; but has no effect on the initial letter box itself.

As with other monolithic objects, if an initial letter box occurs at the top of a fragmentation container and that fragmentation container is too short to contain it, it may be either truncated or sliced. Adjacent content, however, must be fragmented according to its own rules, not truncated or sliced along with the initial letter.

## Appendix A: Synthesizing Alignment Metrics

### A.1: Synthesizing Baselines (and Other Font Metrics) for Text

Some fonts might not contain the metrics information necessary to align text properly as described in this module. User agents may use the following strategies in the absence of a required metric:

Measure the font
  Metrics may be derived from the glyph shapes. For example,
  1. The center of the minus sign (U+2212) can be taken as the mathematical baseline.
  2. The amount by which the lowercase “o” descends below the alphabetic baseline can be subtracted from its highest point to measure the x-height.
     Measuring the x height.
  3. The amount by which the uppercase “O” descends below the alphabetic baseline can be subtracted from its highest point to measure the cap-height.
  4. The bounding box of 永 (U+6C38) can be used to find the ideographic character face edges.
  5. The top edge of the center of the Hebrew maqaf (U+05B3 “־”) can be taken as the Hebrew hanging baseline.
  6. The top edge of the center of the letter Ka can be taken as the hanging baseline. Which Ka is used should depend on the content language:

     Language | Script | Letter
     --- | --- | ---
     | Devanagari | क U+0915 KA
     | Bengali | ক U+0995
     | Gurmukhi | ਕ U+0A15
     | Tibetan | ཀ U+0F40

     Pick a default.

     The hanging baseline is at the top edge of the character ink.
  7. Issue: Add more notes here?

  Somebody sanity-check these heuristics please.

Use a heuristic for the script
  Issue: What does this mean?
Use fallback values
  The following fallback values
  - x-height: .5em;
  - cap-height: .66em;
  - hanging baseline: .6em;
  - Hebrew hanging baseline: ???

  ### A.2: Synthesizing Baselines for Replaced Content

  Copy over text from CSS Writing Modes and expand for additional baseline values.

  Note: Authors can use margins (positive or negative) to adjust the alignment of replaced content within a line.

  In this example, the author is using a set of images to display characters that don’t exist.

      img[src^="/text/"] {
        height: 1em; /* Size to match adjacent text */
        margin-bottom: -0.2em; /* Baseline at 20% above bottom */
      }
      ...
      <p>This is some text with words written in an unencoded script:
      <img src="/text/ch3439.png" alt="...">
        <img src="/text/ch3440.png" alt="...">
        <img src="/text/ch3442.png" alt="...">

  Note: A future level of CSS may include a way of specifying a full baseline table for replaced elements. (This will probably look like a baseline-table property that accepts ''[<baseline-keyword> <percentage>]+''.)

  ## Changes

  Changes since the 8 August 2018 Working Draft include:

  - Added line-sizing property to control how inter-line spacing is calculated. (Issue 3199)

  Changes since the 24 May 2016 Working Draft include:

  - Sketched out property to control the logical height of inline boxes. (Issue 1974)
  - Better defined handling of initial letters that are descendants of other inline boxes and clarified applicability in the presence of ::marker, bidi reordering, and other complications. (Issue 2184, Issue 2705)
  - Defined interaction of initial letters and text-align, letter-spacing, and justification. (Issue 884)
  - Renamed initial-letter to initial-letters. (Issue 862)
  - Better defined interaction of initial letters and floats. (Issue 360, Issue 689)
  - Improved recommended default UA style sheet rules for initial letters.
  - Changed applicability of properties to initial letters from explicit list to reference to properties applying to inline boxes (with a few exceptions). (Issue 2700)
  - Defined sizing properties to apply to initial letters. (Issue 863)
  - Defined shape-outside to apply to initial letters with initial-letter-wrap: all. (Issue 885)
  - Specified that Arabic shaping applies between an initial letter and subsequent text. (Issue 2399)
  - Defined interaction of initial letters and fragmentation. (Issue 2404)
  - Fixed math errors in definition of initial-letter-wrap: grid. (Issue 947)

  ## Acknowledgments

  Special thanks goes to the initial authors, Eric A. Meyer and Michel Suignard.

  In additions to the authors, this specification would not have been possible without the help from:

  David Baron, David M Brown, Oriol Brufau, John Daggett, Stephen Deach, Sylvain Galineau, David Hyatt, Myles Maxfield, Shinyu Murakami, Jan Nicklas, Tess O’Connor, Sujal Parikh, Florian Rivoal, Alan Stearns, Weston Thayer, Bobby Tung, Chris Wilson, Grzegorz Zygmunt.

## Conformance

### Document conventions

Conformance requirements are expressed with a combination of descriptive assertions and RFC 2119 terminology. The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in the normative parts of this document are to be interpreted as described in RFC 2119. However, for readability, these words do not appear in all uppercase letters in this specification.

All of the text of this specification is normative except sections explicitly marked as non-normative, examples, and notes. [RFC2119]

Examples in this specification are introduced with the words “for example” or are set apart from the normative text with `class="example"`, like this:

This is an example of an informative example.

Informative notes begin with the word “Note” and are set apart from the normative text with `class="note"`, like this:

Note, this is an informative note.

Advisements are normative sections styled to evoke special attention and are set apart from other normative text with `<strong class="advisement">`, like this: UAs MUST provide an accessible alternative.

### Conformance classes

Conformance to this specification is defined for three conformance classes:

style sheet
  A CSS style sheet.
renderer
  A UA that interprets the semantics of a style sheet and renders documents that use them.
authoring tool
  A UA that writes a style sheet.

A style sheet is conformant to this specification if all of its statements that use syntax defined in this module are valid according to the generic CSS grammar and the individual grammars of each feature defined in this module.

A renderer is conformant to this specification if, in addition to interpreting the style sheet as defined by the appropriate specifications, it supports all the features defined by this specification by parsing them correctly and rendering the document accordingly. However, the inability of a UA to correctly render a document due to limitations of the device does not make the UA non-conformant. (For example, a UA is not required to render color on a monochrome monitor.)

An authoring tool is conformant to this specification if it writes style sheets that are syntactically correct according to the generic CSS grammar and the individual grammars of each feature in this module, and meet all other conformance requirements of style sheets as described in this module.

### Requirements for Responsible Implementation of CSS

The following sections define several conformance requirements for implementing CSS responsibly, in a way that promotes interoperability in the present and future.

#### Partial Implementations

So that authors can exploit the forward-compatible parsing rules to assign fallback values, CSS renderers must treat as invalid (and ignore as appropriate) any at-rules, properties, property values, keywords, and other syntactic constructs for which they have no usable level of support. In particular, user agents must not selectively ignore unsupported property values and honor supported values in a single multi-value property declaration: if any value is considered invalid (as unsupported values must be), CSS requires that the entire declaration be ignored.

#### Implementations of Unstable and Proprietary Features

To avoid clashes with future stable CSS features, the CSSWG recommends following best practices for the implementation of unstable features and proprietary extensions to CSS.

#### Implementations of CR-level Features

Once a specification reaches the Candidate Recommendation stage, implementers should release an unprefixed implementation of any CR-level feature they can demonstrate to be correctly implemented according to spec, and should avoid exposing a prefixed variant of that feature.

To establish and maintain the interoperability of CSS across implementations, the CSS Working Group requests that non-experimental CSS renderers submit an implementation report (and, if necessary, the testcases used for that implementation report) to the W3C before releasing an unprefixed implementation of any CSS features. Testcases submitted to W3C are subject to review and correction by the CSS Working Group.

Further information on submitting testcases and implementation reports can be found from on the CSS Working Group’s website at http://www.w3.org/Style/CSS/Test/. Questions should be directed to the public-css-testsuite@w3.org mailing list.

## Index

### Terms defined by this specification

- alignment-baseline, in §3.2.2
- all, in §5.9
- alphabetic
  - value for alignment-baseline, in §3.2.2
  - value for dominant-baseline, in §3.1
  - value for initial-letters-align, in §5.4
  - value for leading-trim-under, in §3.5
- atomic initial letter, in §5.5
- atomic initial letter box, in §5.5
- auto
  - value for alignment-baseline, in §3.2.1
  - value for dominant-baseline, in §3.1
- baseline
  - dfn for baseline-shift, in §3.2.3
  - value for alignment-baseline, in §3.2.2
- baseline-shift, in §3.2.3
- baseline-source, in §3.2.1
- border-box, in §5.4
- bottom, in §3.2.2
- cap, in §3.5
- center, in §3.2.2
- central
  - value for alignment-baseline, in §3.2.2
  - value for dominant-baseline, in §3.1
- dominant baseline, in §3.1
- dominant-baseline, in §3.1
- drop, in §5.3
- dropped initial, in §5.1.1
- ex, in §3.5
- first
  - value for alignment-baseline, in §3.2.1
  - value for initial-letters-wrap, in §5.9
- grid, in §5.9
- hanging
  - value for dominant-baseline, in §3.1
  - value for initial-letters-align, in §5.4
- hebrew, in §5.4
- ideographic
  - value for alignment-baseline, in §3.2.2
  - value for dominant-baseline, in §3.1
  - value for initial-letters-align, in §5.4
  - value for leading-trim-over, leading-trim, in §3.5
  - value for leading-trim-under, in §3.5
- ideographic-ink
  - value for leading-trim-over, leading-trim, in §3.5
  - value for leading-trim-under, in §3.5
- initial letter, in §5.3
- initial letter box, in §5.3
- initial-letters, in §5.3
- initial-letters-align, in §5.4
- initial letter sink, in §5.3
- initial letter size, in §5.3
- initial-letters-wrap, in §5.9
- inline initial letter, in §5.5
- inline initial letter box, in §5.5
- inline-sizing, in §4.1
- <integer>, in §5.3
- last, in §3.2.1
- leading-trim, in §3.5
- leading-trim-over, in §3.5
- leading-trim-under, in §3.5
- legacy, in §3.4
- <length>
  - value for baseline-shift, in §3.2.3
  - value for initial-letters-wrap, in §5.9
  - value for line-height, in §3.3.1
- line box, in §2
- line-height, in §3.3.1
- line-sizing, in §3.4
- mathematical
  - value for alignment-baseline, in §3.2.2
  - value for dominant-baseline, in §3.1
- middle
  - value for alignment-baseline, in §3.2.2
  - value for dominant-baseline, in §3.1
- none, in §5.9
- normal
  - value for initial-letters, in §5.3
  - value for inline-sizing, in §4.1
  - value for leading-trim-over, leading-trim, in §3.5
  - value for leading-trim-under, in §3.5
  - value for line-height, in §3.3.1
  - value for line-sizing, in §3.4
- <number>
  - value for initial-letters, in §5.3
  - value for line-height, in §3.3.1
- <percentage>
  - value for baseline-shift, in §3.2.3
  - value for initial-letters-wrap, in §5.9
  - value for line-height, in §3.3.1
- raise, in §5.3
- raised initial, in §5.1.3
- root inline box, in §2
- sink, in §5.3
- stretch, in §4.1
- strut, in §3.3.1
- sub, in §3.2.3
- sunken initial, in §5.1.2
- super, in §3.2.3
- text
  - value for leading-trim-over, leading-trim, in §3.5
  - value for leading-trim-under, in §3.5
- text-after-edge, in §3.2.2
- text-before-edge, in §3.2.2
- text-bottom
  - value for alignment-baseline, in §3.2.2
  - value for dominant-baseline, in §3.1
- text-top
  - value for alignment-baseline, in §3.2.2
  - value for dominant-baseline, in §3.1
- top, in §3.2.2
- vertical-align, in §3.2

https://drafts.csswg.org/css-align-3/#propdef-align-content Referenced in:

- 2. Inline Layout Box Model
- 5.7.1. Alignment Within an Initial Letter Box (2)

https://drafts.csswg.org/css-align-3/#propdef-align-self Referenced in:

- 3.2.2. Alignment Baseline Type: the alignment-baseline longhand

https://drafts.csswg.org/css-align-3/#alignment-baseline Referenced in:

- 3.1. Dominant Baselines: the dominant-baseline property
- 3.2.2. Alignment Baseline Type: the alignment-baseline longhand

https://drafts.csswg.org/css-align-3/#shared-alignment-context Referenced in:

- 3.1. Dominant Baselines: the dominant-baseline property

https://drafts.csswg.org/css-align-3/#baseline-alignment Referenced in:

- 3.1. Dominant Baselines: the dominant-baseline property

https://drafts.csswg.org/css-align-3/#baseline-set Referenced in:

- 3.2.2. Alignment Baseline Type: the alignment-baseline longhand

https://drafts.csswg.org/css-align-3/#first-baseline-set Referenced in:

- 3.2.1. Alignment Baseline Source: the baseline-source longhand

https://drafts.csswg.org/css-align-3/#first-baseline-alignment Referenced in:

- 3.2.1. Alignment Baseline Source: the baseline-source longhand (2)

https://drafts.csswg.org/css-align-3/#propdef-justify-self Referenced in:

- 3.2.2. Alignment Baseline Type: the alignment-baseline longhand
- 5.9. Initial Letter Wrapping: the initial-letters-wrap property

https://drafts.csswg.org/css-align-3/#last-baseline-set Referenced in:

- 3.2.1. Alignment Baseline Source: the baseline-source longhand

https://drafts.csswg.org/css-align-3/#last-baseline-alignment Referenced in:

- 3.2.1. Alignment Baseline Source: the baseline-source longhand (2)

https://drafts.csswg.org/css-align-3/#synthesize-baseline Referenced in:

- 3.2.2. Alignment Baseline Type: the alignment-baseline longhand (2)

https://drafts.csswg.org/css-align-3/#synthesize-baseline Referenced in:

- 3.2.2. Alignment Baseline Type: the alignment-baseline longhand (2)

https://drafts.csswg.org/css-box-3/#border Referenced in:

- 2. Inline Layout Box Model (2)

https://drafts.csswg.org/css-box-3/#content-area Referenced in:

- 4.1. Inline Box Heights: the inline-sizing property (2) (3)

https://drafts.csswg.org/css-box-3/#content-box Referenced in:

- 2. Inline Layout Box Model
- 3.4. Line Sizing Containment: the line-sizing property (2)

https://drafts.csswg.org/css-box-3/#margin Referenced in:

- 2. Inline Layout Box Model (2)

https://drafts.csswg.org/css-box-3/#margin-box Referenced in:

- 3.2.2. Alignment Baseline Type: the alignment-baseline longhand
- 3.3. Line Spacing: the line-height property
- 3.4. Line Sizing Containment: the line-sizing property
- 5.11.3. Interaction with floats

https://drafts.csswg.org/css-box-3/#margin-edge Referenced in:

- 4.1. Inline Box Heights: the inline-sizing property
- 5.8.3. Inline Positioning and Kerning
- 5.10.3. Ancestor Inlines

https://drafts.csswg.org/css-box-3/#padding Referenced in:

- 2. Inline Layout Box Model (2)

https://drafts.csswg.org/css-break-3/#fragment Referenced in:

- 2. Inline Layout Box Model
- 5.11.4. Interaction with Fragmentation (Pagination) (2)

https://drafts.csswg.org/css-break-3/#monolithic Referenced in:

- 5.11.4. Interaction with Fragmentation (Pagination) (2)

https://drafts.csswg.org/css-break-3/#propdef-orphans Referenced in:

- 5.11.4. Interaction with Fragmentation (Pagination)

https://drafts.csswg.org/css-break-4/#box-fragment Referenced in:

- 3.4. Line Sizing Containment: the line-sizing property

https://drafts.csswg.org/css-break-4/#forced-break Referenced in:

- 5.11.4. Interaction with Fragmentation (Pagination)

https://drafts.csswg.org/css-break-4/#fragmentation Referenced in:

- 5.11.4. Interaction with Fragmentation (Pagination)

https://drafts.csswg.org/css-break-4/#fragmentation-container Referenced in:

- 2. Inline Layout Box Model
- 5.11.4. Interaction with Fragmentation (Pagination) (2) (3)

https://drafts.csswg.org/css-break-4/#propdef-widows Referenced in:

- 5.11.4. Interaction with Fragmentation (Pagination)

https://drafts.csswg.org/css-cascade-4/#computed-value Referenced in:

- 3.3.1. Leading and half-leading (2)
- 5.3.1. Applicability
- 5.6. Font Sizing of Initial Letters

https://drafts.csswg.org/css-cascade-4/#longhand Referenced in:

- 3.5. Leading Control: the leading-trim-over and leading-trim-under properties and leading-trim shorthand
- 5.5.1. Properties Applying to Initial Letters (2)

https://drafts.csswg.org/css-cascade-4/#shorthand-property Referenced in:

- 3.2. Transverse Box Alignment: the vertical-align property
- 3.5. Leading Control: the leading-trim-over and leading-trim-under properties and leading-trim shorthand

https://drafts.csswg.org/css-cascade-4/#specified-value Referenced in:

- 3.3.1. Leading and half-leading

https://drafts.csswg.org/css-cascade-4/#longhand Referenced in:

- 3.5. Leading Control: the leading-trim-over and leading-trim-under properties and leading-trim shorthand
- 5.5.1. Properties Applying to Initial Letters (2)

https://drafts.csswg.org/css-cascade-4/#used-value Referenced in:

- 5.3.1. Applicability
- 5.6. Font Sizing of Initial Letters

https://drafts.csswg.org/css-display-3/#absolutely-positioned Referenced in:

- 2. Inline Layout Box Model

https://drafts.csswg.org/css-display-3/#anonymous Referenced in:

- 2. Inline Layout Box Model

https://drafts.csswg.org/css-display-3/#atomic-inline Referenced in:

- 2. Inline Layout Box Model (2)
- 3.2.2. Alignment Baseline Type: the alignment-baseline longhand
- 5.5. Initial Letter Layout
- 5.5.1. Properties Applying to Initial Letters (2)
- 5.7. Sizing the Initial Letter Box

https://drafts.csswg.org/css-display-3/#valdef-display-block Referenced in:

- 5.3.1. Applicability

https://drafts.csswg.org/css-display-3/#block-container Referenced in:

- 2. Inline Layout Box Model (2) (3) (4) (5)
- 3.3.1. Leading and half-leading

https://drafts.csswg.org/css-display-3/#block-container Referenced in:

- 2. Inline Layout Box Model (2) (3) (4) (5)
- 3.3.1. Leading and half-leading

https://drafts.csswg.org/css-display-3/#block-formatting-context Referenced in:

- 5.10. Line Layout
- 5.11.3. Interaction with floats

https://drafts.csswg.org/css-display-3/#box tree Referenced in:

- 2. Inline Layout Box Model

https://drafts.csswg.org/css-display-3/#containing-block Referenced in:

- 2. Inline Layout Box Model (2)
- 5.3.1. Applicability

https://drafts.csswg.org/css-display-3/#propdef-display Referenced in:

- 5.3.1. Applicability

https://drafts.csswg.org/css-display-3/#formatting-context Referenced in:

- 2. Inline Layout Box Model

https://drafts.csswg.org/css-display-3/#in-flow Referenced in:

- 2. Inline Layout Box Model
- 5.3. Creating Initial Letters: the initial-letters property
- 5.11.3. Interaction with floats

https://drafts.csswg.org/css-display-3/#independent-formatting-context Referenced in:

- 5.5. Initial Letter Layout
- 5.11.2. Short paragraphs with initial letters

https://drafts.csswg.org/css-display-3/#inline-box Referenced in:

- 2. Inline Layout Box Model (2) (3) (4) (5)
- 3.3. Line Spacing: the line-height property
- 3.3.1. Leading and half-leading
- 3.4. Line Sizing Containment: the line-sizing property
- 4.1. Inline Box Heights: the inline-sizing property (2) (3) (4)
- 5.3.1. Applicability
- 5.5. Initial Letter Layout
- 5.5.1. Properties Applying to Initial Letters
- 5.10.3. Ancestor Inlines (2)

https://drafts.csswg.org/css-display-3/#inline-formatting-context Referenced in:

- 2. Inline Layout Box Model (2) (3)
- 5.5. Initial Letter Layout

https://drafts.csswg.org/css-display-3/#valdef-display-inline-block Referenced in:

- 3.2.1. Alignment Baseline Source: the baseline-source longhand

https://drafts.csswg.org/css-display-3/#inline-level Referenced in:

- 2. Inline Layout Box Model (2) (3)
- 5.3.1. Applicability
- 5.11.3. Interaction with floats

https://drafts.csswg.org/css-display-3/#inline-level-box Referenced in:

- 2. Inline Layout Box Model (2)
- 3.3. Line Spacing: the line-height property
- 3.3.1. Leading and half-leading
- 5.3. Creating Initial Letters: the initial-letters property
- 5.3.1. Applicability (2)

https://drafts.csswg.org/css-display-3/#inline-level Referenced in:

- 2. Inline Layout Box Model (2) (3)
- 5.3.1. Applicability
- 5.11.3. Interaction with floats

https://drafts.csswg.org/css-display-3/#replaced-element Referenced in:

- 5.5. Initial Letter Layout

https://drafts.csswg.org/css-display-3/#text-run Referenced in:

- 2. Inline Layout Box Model

https://drafts.csswg.org/css-fonts-3/#propdef-font-size Referenced in:

- 3.3.1. Leading and half-leading
- 5.5.1. Properties Applying to Initial Letters
- 5.6. Font Sizing of Initial Letters

https://drafts.csswg.org/css-lists-3/#valdef-list-style-position-inside Referenced in:

- 5.3.1. Applicability

https://drafts.csswg.org/css-multicol-1/#column-box Referenced in:

- 2. Inline Layout Box Model

https://drafts.csswg.org/css-multicol-1/#multi-column-layout Referenced in:

- 2. Inline Layout Box Model

https://drafts.csswg.org/css-page-floats-3/#float Referenced in:

- 2. Inline Layout Box Model

https://drafts.csswg.org/css-page-floats-3/#valdef-float-none Referenced in:

- 5.3.1. Applicability

https://drafts.csswg.org/css-position-3/#propdef-position Referenced in:

- 5.3.1. Applicability

https://drafts.csswg.org/css-position-3/#valdef-position-static Referenced in:

- 5.3.1. Applicability

https://drafts.csswg.org/css-pseudo-4/#selectordef-first-letter Referenced in:

- 5.2. Selecting Initial Letters (2) (3) (4)
- 5.3.1. Applicability (2)

https://drafts.csswg.org/css-pseudo-4/#selectordef-marker Referenced in:

- 5.3.1. Applicability (2)
- Changes

https://drafts.csswg.org/css-pseudo-4/#first-formatted-line Referenced in:

- 3.5. Leading Control: the leading-trim-over and leading-trim-under properties and leading-trim shorthand (2)

https://drafts.csswg.org/css-ruby-1/#ruby Referenced in:

- 5.3.1. Applicability (2)

https://drafts.csswg.org/css-ruby-1/#ruby-annotation-box Referenced in:

- 2. Inline Layout Box Model

https://drafts.csswg.org/css-shapes-1/#propdef-shape-outside Referenced in:

- Changes

https://drafts.csswg.org/css-sizing-3/#valdef-width-auto Referenced in:

- 5.7. Sizing the Initial Letter Box

https://drafts.csswg.org/css-sizing-3/#automatic-size Referenced in:

- 5.5. Initial Letter Layout
- 5.7. Sizing the Initial Letter Box (2)
- 5.7.1. Alignment Within an Initial Letter Box
- 5.8.3. Inline Positioning and Kerning

https://drafts.csswg.org/css-sizing-3/#propdef-box-sizing Referenced in:

- 5.5.1. Properties Applying to Initial Letters
- 5.5.2. Margins, Borders, and Padding
- 5.7. Sizing the Initial Letter Box

https://drafts.csswg.org/css-sizing-3/#definite Referenced in:

- 5.7. Sizing the Initial Letter Box (2)
- 5.7.1. Alignment Within an Initial Letter Box (2)

https://drafts.csswg.org/css-sizing-3/#inner-size Referenced in:

- 2. Inline Layout Box Model

https://drafts.csswg.org/css-sizing-3/#max-width Referenced in:

- 5.7. Sizing the Initial Letter Box

https://drafts.csswg.org/css-sizing-3/#min-width Referenced in:

- 5.7. Sizing the Initial Letter Box

https://drafts.csswg.org/css-sizing-3/#height Referenced in:

- 5.7. Sizing the Initial Letter Box

https://drafts.csswg.org/css-sizing-3/#width Referenced in:

- 5.7. Sizing the Initial Letter Box

https://drafts.csswg.org/css-sizing-3/#sizing-property Referenced in:

- 5.5.1. Properties Applying to Initial Letters
- Changes

https://drafts.csswg.org/css-sizing-3/#stretch-fit Referenced in:

- 4.1. Inline Box Heights: the inline-sizing property

https://drafts.csswg.org/css-text-3/#content-language Referenced in:

- A.1: Synthesizing Baselines (and Other Font Metrics) for Text

https://drafts.csswg.org/css-text-3/#forced-line-break Referenced in:

- 2. Inline Layout Box Model

https://drafts.csswg.org/css-text-3/#hang Referenced in:

- 5.7. Sizing the Initial Letter Box

https://drafts.csswg.org/css-text-3/#propdef-hanging-punctuation Referenced in:

- 5.7. Sizing the Initial Letter Box
- 5.10.2. Edge Effects: Indentation and Hanging Punctuation (2)

https://drafts.csswg.org/css-text-3/#justification-opportunity Referenced in:

- 5.10.1. Inline Flow Layout: Alignment and Justification (2)

https://drafts.csswg.org/css-text-3/#propdef-letter-spacing Referenced in:

- 5.9. Initial Letter Wrapping: the initial-letters-wrap property
- 5.10.1. Inline Flow Layout: Alignment and Justification
- 5.10.3. Ancestor Inlines
- Changes

https://drafts.csswg.org/css-text-3/#propdef-text-align Referenced in:

- 5.7.1. Alignment Within an Initial Letter Box (2)
- Changes

https://drafts.csswg.org/css-text-3/#propdef-text-indent Referenced in:

- 5.10.2. Edge Effects: Indentation and Hanging Punctuation

https://drafts.csswg.org/css-text-3/#typographic-character-unit Referenced in:

- 5.9. Initial Letter Wrapping: the initial-letters-wrap property
- 5.10.1. Inline Flow Layout: Alignment and Justification

https://drafts.csswg.org/css-text-3/#unicode-script Referenced in:

- 5.4. Alignment of Initial Letters: the initial-letters-align property (2) (3)

https://drafts.csswg.org/css-text-3/#word-separator Referenced in:

- 5.10.1. Inline Flow Layout: Alignment and Justification

https://drafts.csswg.org/css-text-3/#propdef-word-spacing Referenced in:

- 5.10.1. Inline Flow Layout: Alignment and Justification

https://drafts.csswg.org/css-values-3/#integer-value Referenced in:

- 5.3. Creating Initial Letters: the initial-letters property (2)

https://drafts.csswg.org/css-values-3/#length-value Referenced in:

- 3.2.3. Alignment Shift: the baseline-shift longhand
- 3.3.1. Leading and half-leading (2)
- 5.9. Initial Letter Wrapping: the initial-letters-wrap property (2)

https://drafts.csswg.org/css-values-3/#number-value Referenced in:

- 3.3.1. Leading and half-leading (2)
- 5.3. Creating Initial Letters: the initial-letters property (2) (3)

https://drafts.csswg.org/css-values-3/#percentage-value Referenced in:

- 3.2.3. Alignment Shift: the baseline-shift longhand
- 3.3.1. Leading and half-leading
- 5.9. Initial Letter Wrapping: the initial-letters-wrap property (2)
- A.2: Synthesizing Baselines for Replaced Content

https://drafts.csswg.org/css-values-4/#comb-all Referenced in:

- 5.3. Creating Initial Letters: the initial-letters property

https://drafts.csswg.org/css-values-4/#typedef-length-percentage Referenced in:

- 3.2.3. Alignment Shift: the baseline-shift longhand (2)
- 3.3.1. Leading and half-leading
- 5.9. Initial Letter Wrapping: the initial-letters-wrap property (2)

https://drafts.csswg.org/css-values-4/#mult-opt Referenced in:

- 5.3. Creating Initial Letters: the initial-letters property
- 5.4. Alignment of Initial Letters: the initial-letters-align property

https://drafts.csswg.org/css-values-4/#em Referenced in:

- 5.6. Font Sizing of Initial Letters

https://drafts.csswg.org/css-values-4/#comb-one Referenced in:

- 3.1. Dominant Baselines: the dominant-baseline property (2) (3) (4) (5) (6) (7) (8)
- 3.2.1. Alignment Baseline Source: the baseline-source longhand (2)
- 3.2.2. Alignment Baseline Type: the alignment-baseline longhand (2) (3) (4) (5) (6) (7) (8) (9) (10)
- 3.2.3. Alignment Shift: the baseline-shift longhand (2)
- 3.3.1. Leading and half-leading (2)
- 3.4. Line Sizing Containment: the line-sizing property
- 3.5. Leading Control: the leading-trim-over and leading-trim-under properties and leading-trim shorthand (2) (3) (4) (5) (6) (7) (8) (9) (10) (11) (12) (13) (14)
- 4.1. Inline Box Heights: the inline-sizing property
- 5.3. Creating Initial Letters: the initial-letters property (2) (3)
- 5.4. Alignment of Initial Letters: the initial-letters-align property (2) (3) (4)
- 5.9. Initial Letter Wrapping: the initial-letters-wrap property (2) (3) (4)

https://drafts.csswg.org/css-values-4/#comb-any Referenced in:

- 3.2. Transverse Box Alignment: the vertical-align property (2)

https://drafts.csswg.org/css-writing-modes-4/#block-axis Referenced in:

- 2. Inline Layout Box Model
- 5.5. Initial Letter Layout
- 5.7.1. Alignment Within an Initial Letter Box (2)
- 5.8.2. Block-axis Positioning

https://drafts.csswg.org/css-writing-modes-4/#block-flow-direction Referenced in:

- 2. Inline Layout Box Model

https://drafts.csswg.org/css-writing-modes-4/#block-size Referenced in:

- 5.7. Sizing the Initial Letter Box (2)
- 5.7.1. Alignment Within an Initial Letter Box

https://drafts.csswg.org/css-writing-modes-4/#block-axis Referenced in:

- 2. Inline Layout Box Model
- 5.5. Initial Letter Layout
- 5.7.1. Alignment Within an Initial Letter Box (2)
- 5.8.2. Block-axis Positioning

https://drafts.csswg.org/css-writing-modes-4/#block-end Referenced in:

- 5.1.1. Drop Initial

https://drafts.csswg.org/css-writing-modes-4/#block-start Referenced in:

- 5.1.1. Drop Initial

https://drafts.csswg.org/css-writing-modes-4/#horizontal-writing-mode Referenced in:

- 3.1. Dominant Baselines: the dominant-baseline property

https://drafts.csswg.org/css-writing-modes-4/#inline-axis Referenced in:

- 2. Inline Layout Box Model (2)
- 5.7.1. Alignment Within an Initial Letter Box (2)
- 5.8.3. Inline Positioning and Kerning

https://drafts.csswg.org/css-writing-modes-4/#inline-size Referenced in:

- 5.7.1. Alignment Within an Initial Letter Box
- 5.8.3. Inline Positioning and Kerning

https://drafts.csswg.org/css-writing-modes-4/#inline-axis Referenced in:

- 2. Inline Layout Box Model (2)
- 5.7.1. Alignment Within an Initial Letter Box (2)
- 5.8.3. Inline Positioning and Kerning

https://drafts.csswg.org/css-writing-modes-4/#inline-start Referenced in:

- 5.8.3. Inline Positioning and Kerning (2)
- 5.11.3. Interaction with floats

https://drafts.csswg.org/css-writing-modes-4/#line-left Referenced in:

- 2. Inline Layout Box Model (2)

https://drafts.csswg.org/css-writing-modes-4/#line-over Referenced in:

- 3.5. Leading Control: the leading-trim-over and leading-trim-under properties and leading-trim shorthand (2)
- 5.4. Alignment of Initial Letters: the initial-letters-align property

https://drafts.csswg.org/css-writing-modes-4/#line-right Referenced in:

- 2. Inline Layout Box Model (2)

https://drafts.csswg.org/css-writing-modes-4/#line-under Referenced in:

- 5.4. Alignment of Initial Letters: the initial-letters-align property

https://drafts.csswg.org/css-writing-modes-4/#logical-height Referenced in:

- 2. Inline Layout Box Model (2)
- 4.1. Inline Box Heights: the inline-sizing property (2)

https://drafts.csswg.org/css-writing-modes-4/#logical-width Referenced in:

- 2. Inline Layout Box Model (2) (3) (4)
- 5.9. Initial Letter Wrapping: the initial-letters-wrap property

https://drafts.csswg.org/css-writing-modes-4/#valdef-text-orientation-mixed Referenced in:

- 3.1. Dominant Baselines: the dominant-baseline property

https://drafts.csswg.org/css-writing-modes-4/#over Referenced in:

- 5.4. Alignment of Initial Letters: the initial-letters-align property (2) (3) (4)

https://drafts.csswg.org/css-writing-modes-4/#valdef-text-orientation-sideways Referenced in:

- 3.1. Dominant Baselines: the dominant-baseline property

https://drafts.csswg.org/css-writing-modes-4/#valdef-text-orientation-sideways-right Referenced in:

- 3.1. Dominant Baselines: the dominant-baseline property

https://drafts.csswg.org/css-writing-modes-4/#propdef-text-orientation Referenced in:

- 3.1. Dominant Baselines: the dominant-baseline property (2)

https://drafts.csswg.org/css-writing-modes-4/#under Referenced in:

- 5.4. Alignment of Initial Letters: the initial-letters-align property (2) (3) (4)
- 5.8.2. Block-axis Positioning (2)

https://drafts.csswg.org/css-writing-modes-4/#valdef-text-orientation-upright Referenced in:

- 3.1. Dominant Baselines: the dominant-baseline property

https://drafts.csswg.org/css-writing-modes-4/#vertical-writing-mode Referenced in:

- 3.1. Dominant Baselines: the dominant-baseline property (2) (3)

https://drafts.csswg.org/css2/visuren.html#propdef-clear Referenced in:

- 5.11.2. Short paragraphs with initial letters
- 5.11.3. Interaction with floats

https://drafts.csswg.org/css2/visuren.html#propdef-float Referenced in:

- 5.3.1. Applicability

https://drafts.csswg.org/css2/visudet.html#propdef-height Referenced in:

- 4.1. Inline Box Heights: the inline-sizing property

### Terms defined by reference

- [css-align-3] defines the following terms:
  - align-content
  - align-self
  - alignment baseline
  - alignment context
  - baseline alignment
  - baseline set
  - first baseline set
  - first-baseline alignment
  - justify-self
  - last baseline set
  - last-baseline alignment
  - synthesize baseline
  - synthesized baseline
- [css-box-3] defines the following terms:
  - border
  - content area
  - content box
  - margin
  - margin box
  - margin edge
  - padding
- [css-break-3] defines the following terms:
  - fragment
  - monolithic
  - orphans
- [css-break-4] defines the following terms:
  - box fragment
  - forced break
  - fragmentation
  - fragmentation container
  - widows
- [css-cascade-4] defines the following terms:
  - computed value
  - longhand
  - shorthand
  - specified value
  - sub-property
  - used value
- [CSS-DISPLAY-3] defines the following terms:
  - absolutely positioned box
  - anonymous box
  - atomic inline
  - block
  - block container
  - block container box
  - block formatting context
  - box tree
  - containing block
  - display
  - formatting context
  - in-flow
  - independent formatting context
  - inline box
  - inline formatting context
  - inline-block
  - inline-level
  - inline-level box
  - inline-level content
  - replaced element
  - text run
- [css-fonts-3] defines the following terms:
  - font-size
- [css-lists-3] defines the following terms:
  - inside
- [CSS-MULTICOL-1] defines the following terms:
  - column box
  - multi-column layout
- [css-page-floats-3] defines the following terms:
  - float
  - none
- [css-position-3] defines the following terms:
  - position
  - static
- [CSS-PSEUDO-4] defines the following terms:
  - ::first-letter
  - ::marker
  - first formatted line
- [css-ruby-1] defines the following terms:
  - ruby
  - ruby annotation
- [css-shapes-1] defines the following terms:
  - shape-outside
- [css-sizing-3] defines the following terms:
  - auto
  - automatic size
  - box-sizing
  - definite
  - inner size
  - max size
  - min size
  - preferred height
  - preferred width
  - sizing property
  - stretch fit
- [CSS-TEXT-3] defines the following terms:
  - content language
  - forced line break
  - hang
  - hanging-punctuation
  - justification opportunity
  - letter-spacing
  - text-align
  - text-indent
  - typographic character unit
  - unicode script
  - word separator
  - word-spacing
- [css-values-3] defines the following terms:
  - <integer>
  - <length>
  - <number>
  - <percentage>
- [css-values-4] defines the following terms:
  - &&
  - <length-percentage>
  - ?
  - em
  - |
  - ||
- [css-writing-modes-4] defines the following terms:
  - block axis
  - block flow direction
  - block size
  - block-axis
  - block-end
  - block-start
  - horizontal writing mode
  - inline axis
  - inline size
  - inline-axis
  - inline-start
  - line-left
  - line-over
  - line-right
  - line-under
  - logical height
  - logical width
  - mixed
  - over
  - sideways
  - sideways-right
  - text-orientation
  - under
  - upright
  - vertical writing mode
- [CSS2] defines the following terms:
  - clear
  - float
  - height

## References

### Normative References

[CSS-ALIGN-3]
  Elika Etemad; Tab Atkins Jr.. CSS Box Alignment Module Level 3. 6 December 2018. WD. URL: https://www.w3.org/TR/css-align-3/
[CSS-BOX-3]
  Elika Etemad. CSS Box Model Module Level 3. 18 December 2018. WD. URL: https://www.w3.org/TR/css-box-3/
[CSS-BREAK-3]
  Rossen Atanassov; Elika Etemad. CSS Fragmentation Module Level 3. 4 December 2018. CR. URL: https://www.w3.org/TR/css-break-3/
[CSS-BREAK-4]
  Rossen Atanassov; Elika Etemad. CSS Fragmentation Module Level 4. 18 December 2018. WD. URL: https://www.w3.org/TR/css-break-4/
[CSS-CASCADE-4]
  Elika Etemad; Tab Atkins Jr.. CSS Cascading and Inheritance Level 4. 28 August 2018. CR. URL: https://www.w3.org/TR/css-cascade-4/
[CSS-DISPLAY-3]
  Tab Atkins Jr.; Elika Etemad. CSS Display Module Level 3. 28 August 2018. CR. URL: https://www.w3.org/TR/css-display-3/
[CSS-FONTS-3]
  John Daggett; Myles Maxfield; Chris Lilley. CSS Fonts Module Level 3. 20 September 2018. REC. URL: https://www.w3.org/TR/css-fonts-3/
[CSS-LISTS-3]
  Elika Etemad; Tab Atkins Jr.. CSS Lists Module Level 3. 25 April 2019. WD. URL: https://www.w3.org/TR/css-lists-3/
[CSS-MULTICOL-1]
  Florian Rivoal; Rachel Andrew. CSS Multi-column Layout Module Level 1. 28 May 2018. WD. URL: https://www.w3.org/TR/css-multicol-1/
[CSS-PAGE-FLOATS-3]
  Johannes Wilm. CSS Page Floats. 15 September 2015. WD. URL: https://www.w3.org/TR/css-page-floats-3/
[CSS-PSEUDO-4]
  Daniel Glazman; Elika Etemad; Alan Stearns. CSS Pseudo-Elements Module Level 4. 25 February 2019. WD. URL: https://www.w3.org/TR/css-pseudo-4/
[CSS-RUBY-1]
  Elika Etemad; Koji Ishii. CSS Ruby Layout Module Level 1. 5 August 2014. WD. URL: https://www.w3.org/TR/css-ruby-1/
[CSS-SHAPES-1]
  Vincent Hardy; Rossen Atanassov; Alan Stearns. CSS Shapes Module Level 1. 20 March 2014. CR. URL: https://www.w3.org/TR/css-shapes-1/
[CSS-SIZING-3]
  Tab Atkins Jr.; Elika Etemad. CSS Intrinsic & Extrinsic Sizing Module Level 3. 22 May 2019. WD. URL: https://www.w3.org/TR/css-sizing-3/
[CSS-TEXT-3]
  Elika Etemad; Koji Ishii; Florian Rivoal. CSS Text Module Level 3. 12 December 2018. WD. URL: https://www.w3.org/TR/css-text-3/
[CSS-VALUES-3]
  Tab Atkins Jr.; Elika Etemad. CSS Values and Units Module Level 3. 31 January 2019. CR. URL: https://www.w3.org/TR/css-values-3/
[CSS-VALUES-4]
  Tab Atkins Jr.; Elika Etemad. CSS Values and Units Module Level 4. 31 January 2019. WD. URL: https://www.w3.org/TR/css-values-4/
[CSS-WRITING-MODES-4]
  Elika Etemad; Koji Ishii. CSS Writing Modes Level 4. 24 May 2018. CR. URL: https://www.w3.org/TR/css-writing-modes-4/
[CSS2]
  Bert Bos; et al. Cascading Style Sheets Level 2 Revision 1 (CSS 2.1) Specification. 7 June 2011. REC. URL: https://www.w3.org/TR/CSS2/
[QUIRKS]
  Simon Pieters. Quirks Mode Standard. Living Standard. URL: https://quirks.spec.whatwg.org/
[RFC2119]
  S. Bradner. Key words for use in RFCs to Indicate Requirement Levels. March 1997. Best Current Practice. URL: https://tools.ietf.org/html/rfc2119

### Informative References

[CSS-LINE-GRID-1]
  Elika Etemad; Koji Ishii; Alan Stearns. CSS Line Grid Module Level 1. 16 September 2014. WD. URL: https://www.w3.org/TR/css-line-grid-1/
[CSS-POSITION-3]
  Rossen Atanassov; Arron Eicholz. CSS Positioned Layout Module Level 3. 17 May 2016. WD. URL: https://www.w3.org/TR/css-position-3/
[CSS-WRITING-MODES-3]
  Elika Etemad; Koji Ishii. CSS Writing Modes Level 3. 24 May 2018. CR. URL: https://www.w3.org/TR/css-writing-modes-3/
[SELECT]
  Tantek Çelik; et al. Selectors Level 3. 6 November 2018. REC. URL: https://www.w3.org/TR/selectors-3/

## Property Index

Name | Value | Initial | Applies to | Inh. | %ages | Animation type | Canonical order | Computed value
--- | --- | --- | --- | --- | --- | --- | --- | ---
alignment-baseline | baseline | text-bottom | alphabetic | ideographic | middle | central | mathematical | text-top | bottom | center | top | baseline | inline-level boxes, flex items, grid items, table cells | no | N/A | discrete | per grammar | specified keyword
baseline-shift | <length-percentage> | sub | super | 0 | inline-level boxes, flex items, grid items | no | refer to the used value of line-height | discrete | per grammar | the specified keyword and/or a computed <length-percentage> value
baseline-source | auto | first | last | auto | inline-level boxes | no | N/A | discrete | per grammar | specified keyword
dominant-baseline | auto | text-bottom | alphabetic | ideographic | middle | central | mathematical | hanging | text-top | auto | block containers, inline boxes, table rows, table columns, grid containers, and flex containers | yes | N/A | discrete | per grammar | specified keyword
initial-letters | normal | <number> <integer> | <number> && [ drop | raise ]? | normal | certain inline-level boxes and ::first-letter and inside ::marker boxes (see prose) | no | N/A | by computed value type | per grammar | the keyword normal or a number paired with an integer
initial-letters-align | border-box? [ alphabetic | ideographic | hebrew | hanging ] | border-box | alphabetic | certain inline-level boxes and ::first-letter and inside ::marker boxes (see prose) | yes | N/A | discrete | per grammar | specified keyword(s)
initial-letters-wrap | none | first | all | grid | <length-percentage> | none | certain inline-level boxes and ::first-letter and inside ::marker boxes (see prose) | yes | relative to logical width of (last fragment of) initial letter | by computed value type | per grammar | specified keyword or computed <length-percentage> value
inline-sizing | normal | stretch | normal | inline boxes | no | n/a | discrete | per grammar | specified keyword
leading-trim | normal | text | cap | ex | ideographic | ideographic-ink | normal | block containers | no | N/A | discrete | per grammar | the specified keyword
leading-trim-over | normal | text | cap | ex | ideographic | ideographic-ink | normal | block containers | no | N/A | discrete | per grammar | the specified keyword
leading-trim-under | normal | text | alphabetic | ideographic | ideographic-ink | normal | block containers | yes | N/A | discrete | per grammar | the specified keyword
line-height | normal | <number> | <length-percentage> | normal | inline boxes | yes | computed relative to 1em | discrete | per grammar | the specified keyword, a number, or a computed <length> value
line-sizing | legacy | normal | legacy | inline boxes | yes | N/A | discrete | per grammar | the specified keyword
vertical-align | <'baseline-source'> || <'baseline-shift'> || <'alignment-baseline'> | baseline | inline-level boxes | no | N/A | see individual properties | per grammar | see individual properties

## Issues Index

Many aspects of layout here depend on font metrics. While the relevant metrics exist in OpenType for Latin/Cyrillic/Greek and for CJK, they are missing for many other writing systems. For example, the visual top metric for Hebrew has no metric in the OpenType tables. For this module to work well for the world, we need fonts to provide the relevant metrics for all writing systems, and that means both that OpenType needs to allow such metrics and font designers need to provide accurate numbers. ↵
This section is being rewritten. Refer to section 10.8 of [CSS2] for the normative CSS definition or the 2002 Working Draft if you want pretty pictures. (But ignore the old text, half of it’s wrong. We’re not specifying which half, that’s to be determined.) The CSS2 specification should be used as the guideline for implementation. ↵
The CSSWG would like to know which baseline values are necessary: if any can be dropped, or any need to be added. See GitHub issue 859. ↵
Should be text-over and text-under instead of text-top and text-bottom, but maybe it’s better not to use those terms for consistency with legacy vertical-align. See GitHub issue 860. ↵
Add first and last values. Note, in this property, these are combinatorial, whereas in the align/justify-self/content properties, it’s singular. Do we want to align the syntaxes wrt hyphens vs. spaces or what? See GitHub issue 861. ↵
This is a rough draft, not ready for implementation. Also might rename stuff. ↵
Clean up this prose to correctly handle alignment contexts other than inline formatting contexts. ↵
We would prefer to remove the baseline value, and are looking for feedback from SVG user agents as to whether it’s necessary. ↵
The fact that percentages compute to lengths is annoying. See also href="https://github.com/w3c/csswg-drafts/issues/3118">Issue 3118 and Issue 2165. ↵
This is a rought draft of a proposal, and has not yet been approved by the CSSWG. See discussion in Issue 3199, Hyatt’s message, and dbaron’s proposal. ↵
Should this property apply to block containers or to inline boxes? In the latter case, an individual inline could say "pay attention to me" or "don’t pay attention to me". ↵
This is a rought draft of a proposal, and is likely to change significantly as design critiques and use cases are registered. Values and property names may be added, dropped, and/or renamed, and the overall syntax or behavior may change. Do not implement (yet). The CSSWG particularly invites feedback on which font metrics need corresponding keyword values. ↵
We might want to use this opportunity to more precisely define normal, rename it to match, and possibly introduce any other values that may seem necessary. ↵
The editors would appreciate any examples of drop initials in non-western scripts, especially Arabic and Indic scripts. ↵
Should there be a way to opt out of this behavior? See Github Issue 310. ↵
Renaming this property (and the others in this section) is currently under discussion. ↵
Is there a proper typographic term for the hebrew “hanging” baseline? ↵
What is the proper alignment for South Asian scripts that do not have the explicit hanging baseline, such as Tamil or Telugu? See GitHub issue 864 ↵
This only covers the most common cross-linguistic transcription systems. Should we include any other / all script tags in the UA style sheet? ↵
Reword that to handle box-sizing correctly. ↵
What about inheritance to descendants? ↵
Update this calculation to be a) generic across writing systems / alignment points and b) handle non-integer sizes. ↵
Are there other things we need to consider here? ↵
Should the hanging punctuation be included in the box instead (so that the box is drawn around the punctuation when it is made visible through borders/background), but rather only excluded when positioning the box (so that the initial letter remains flush, with the hanging punctuation properly hanging)? See discussion. ↵
Do we need an unconditional first? (I.e. Should we rename this value to auto and add a first value that does not check for spaces?) See GitHub issue 410 ↵
This really needs font-relative lengths to be relative to the used size. ↵
These values and related annoyance is likely unnecessary if someone submits a patch to Blink to support first. ↵
Edit figure to show how auto behaves in varying contexts ↵
The interaction of initial-letters and hanging-punctuation is under discussion. ↵
Handle glyph ink above cap height of font. Proposal: Make it an exclusion area for line boxes and border boxes. Include margin specified on initial-letters as part of exclusion area in order to control spacing. ↵
Draw a box model diagram here. Does the margin of the initial letter collapse with its container? ↵
Whether an inline-end float originating in subsequent lines must clear the initial letter (as inline-start floats do) is still under discussion. There is no aesthetic reason to require it; however it’s yet unclear how the underlying layout model would distinguish between the two cases. ↵
Pick a default. ↵
Somebody sanity-check these heuristics please. ↵
Copy over text from CSS Writing Modes and expand for additional baseline values. ↵
#root-inline-box Referenced in:

- 2. Inline Layout Box Model
- 3.4. Line Sizing Containment: the line-sizing property
- 5.8.2. Block-axis Positioning

#line-box Referenced in:

- 2. Inline Layout Box Model (2) (3) (4)
- 3.3. Line Spacing: the line-height property
- 3.3.1. Leading and half-leading
- 5.10. Line Layout
- 5.11.3. Interaction with floats

#propdef-dominant-baseline Referenced in:

- 3.1. Dominant Baselines: the dominant-baseline property

#dominant-baseline Referenced in:

- 3.2.2. Alignment Baseline Type: the alignment-baseline longhand

#valdef-dominant-baseline-alphabetic Referenced in:

- 3.1. Dominant Baselines: the dominant-baseline property

#valdef-dominant-baseline-central Referenced in:

- 3.1. Dominant Baselines: the dominant-baseline property (2)

#propdef-vertical-align Referenced in:

- 2. Inline Layout Box Model
- 3.1. Dominant Baselines: the dominant-baseline property
- 3.2. Transverse Box Alignment: the vertical-align property (2)
- 3.2.2. Alignment Baseline Type: the alignment-baseline longhand
- 3.2.3. Alignment Shift: the baseline-shift longhand
- 3.3. Line Spacing: the line-height property
- 5.5.1. Properties Applying to Initial Letters (2)

#propdef-baseline-source Referenced in:

- 3.2. Transverse Box Alignment: the vertical-align property
- 3.2.1. Alignment Baseline Source: the baseline-source longhand

#propdef-alignment-baseline Referenced in:

- 3.2. Transverse Box Alignment: the vertical-align property
- 3.2.2. Alignment Baseline Type: the alignment-baseline longhand
- 3.2.3. Alignment Shift: the baseline-shift longhand

#valdef-alignment-baseline-text-bottom Referenced in:

- 3.2.2. Alignment Baseline Type: the alignment-baseline longhand

#valdef-alignment-baseline-text-top Referenced in:

- 3.2.2. Alignment Baseline Type: the alignment-baseline longhand

#valdef-alignment-baseline-top Referenced in:

- 3.2.3. Alignment Shift: the baseline-shift longhand
- 3.3. Line Spacing: the line-height property

#valdef-alignment-baseline-bottom Referenced in:

- 3.2.3. Alignment Shift: the baseline-shift longhand
- 3.3. Line Spacing: the line-height property

#propdef-baseline-shift Referenced in:

- 3.2. Transverse Box Alignment: the vertical-align property
- 3.2.3. Alignment Shift: the baseline-shift longhand

#propdef-line-height Referenced in:

- 3.2.3. Alignment Shift: the baseline-shift longhand (2)
- 3.3. Line Spacing: the line-height property (2) (3)
- 3.3.1. Leading and half-leading (2) (3) (4) (5) (6) (7) (8) (9) (10)
- 3.4. Line Sizing Containment: the line-sizing property (2)
- 4.1. Inline Box Heights: the inline-sizing property (2)
- 5.5.1. Properties Applying to Initial Letters
- 5.6. Font Sizing of Initial Letters

#strut Referenced in:

- 3.3. Line Spacing: the line-height property (2)
- 3.3.1. Leading and half-leading

#valdef-line-height-normal Referenced in:

- 3.3.1. Leading and half-leading (2) (3) (4) (5) (6)

#propdef-line-sizing Referenced in:

- 3.4. Line Sizing Containment: the line-sizing property
- 5.5.1. Properties Applying to Initial Letters
- Changes

#propdef-leading-trim-over Referenced in:

- 3.5. Leading Control: the leading-trim-over and leading-trim-under properties and leading-trim shorthand (2) (3) (4) (5)

#valdef-leading-trim-over-cap Referenced in:

- 3.5. Leading Control: the leading-trim-over and leading-trim-under properties and leading-trim shorthand

#valdef-leading-trim-over-ex Referenced in:

- 3.5. Leading Control: the leading-trim-over and leading-trim-under properties and leading-trim shorthand

#propdef-leading-trim-under Referenced in:

- 3.5. Leading Control: the leading-trim-over and leading-trim-under properties and leading-trim shorthand (2) (3)

#valdef-leading-trim-under-alphabetic Referenced in:

- 3.5. Leading Control: the leading-trim-over and leading-trim-under properties and leading-trim shorthand

#propdef-leading-trim Referenced in:

- 3.5. Leading Control: the leading-trim-over and leading-trim-under properties and leading-trim shorthand (2) (3)

#propdef-inline-sizing Referenced in:

- 4.1. Inline Box Heights: the inline-sizing property
- 5.5.1. Properties Applying to Initial Letters

#valdef-inline-sizing-normal Referenced in:

- 4.1. Inline Box Heights: the inline-sizing property

#dropped-initial Referenced in:

- 5.1.1. Drop Initial
- 5.3. Creating Initial Letters: the initial-letters property

#sunken-initial Referenced in:

- 5.3. Creating Initial Letters: the initial-letters property (2)
- 5.10.1. Inline Flow Layout: Alignment and Justification (2)

#raised-initial Referenced in:

- 5.3. Creating Initial Letters: the initial-letters property (2)
- 5.10.1. Inline Flow Layout: Alignment and Justification

#propdef-initial-letters Referenced in:

- 5.2. Selecting Initial Letters
- 5.3. Creating Initial Letters: the initial-letters property (2) (3) (4) (5) (6) (7) (8) (9) (10) (11)
- 5.3.1. Applicability (2) (3) (4) (5) (6) (7)
- 5.6. Font Sizing of Initial Letters
- 5.6.1. Shaping and Glyph Selection (2)
- 5.8.2. Block-axis Positioning (2)
- 5.10.2. Edge Effects: Indentation and Hanging Punctuation
- Changes

#valdef-initial-letters-normal Referenced in:

- 5.3. Creating Initial Letters: the initial-letters property (2)
- 5.3.1. Applicability (2)
- 5.6.1. Shaping and Glyph Selection

#initial-letters-initial-letter-size Referenced in:

- 5.3. Creating Initial Letters: the initial-letters property (2)
- 5.6. Font Sizing of Initial Letters

#initial-letters-initial-letter-sink Referenced in:

- 5.3. Creating Initial Letters: the initial-letters property (2) (3) (4)
- 5.8.1. Space Below Initial Letters
- 5.8.2. Block-axis Positioning

#valdef-initial-letters-drop Referenced in:

- 5.3. Creating Initial Letters: the initial-letters property

#initial-letter Referenced in:

- 2. Inline Layout Box Model
- 5.1.1. Drop Initial
- 5.2. Selecting Initial Letters
- 5.3.1. Applicability (2) (3) (4)
- 5.4. Alignment of Initial Letters: the initial-letters-align property (2) (3) (4) (5) (6) (7) (8) (9) (10) (11) (12) (13)
- 5.5. Initial Letter Layout
- 5.5.1. Properties Applying to Initial Letters (2)
- 5.6. Font Sizing of Initial Letters
- 5.6.1. Shaping and Glyph Selection
- 5.7. Sizing the Initial Letter Box
- 5.7.1. Alignment Within an Initial Letter Box
- 5.8.1. Space Below Initial Letters
- 5.8.2. Block-axis Positioning (2)
- 5.8.3. Inline Positioning and Kerning (2)
- 5.9. Initial Letter Wrapping: the initial-letters-wrap property (2) (3) (4) (5) (6)
- 5.10. Line Layout
- 5.10.1. Inline Flow Layout: Alignment and Justification
- 5.10.3. Ancestor Inlines (2) (3)
- 5.11.3. Interaction with floats (2) (3) (4) (5) (6) (7) (8) (9) (10) (11) (12)
- 5.11.4. Interaction with Fragmentation (Pagination) (2) (3) (4) (5) (6)

#propdef-initial-letters-align Referenced in:

- 5.4. Alignment of Initial Letters: the initial-letters-align property (2)
- 5.4.1. UA Default Stylesheet for initial-letters-align
- 5.5.2. Margins, Borders, and Padding
- 5.6. Font Sizing of Initial Letters
- 5.8.2. Block-axis Positioning

#valdef-initial-letters-align-border-box Referenced in:

- 5.4. Alignment of Initial Letters: the initial-letters-align property (2)
- 5.5.2. Margins, Borders, and Padding

#inline-initial-letter Referenced in:

- 5.5.1. Properties Applying to Initial Letters
- 5.6. Font Sizing of Initial Letters
- 5.6.1. Shaping and Glyph Selection
- 5.7. Sizing the Initial Letter Box (2)
- 5.7.1. Alignment Within an Initial Letter Box

#atomic-initial-letter Referenced in:

- 5.6. Font Sizing of Initial Letters
- 5.7. Sizing the Initial Letter Box

#propdef-initial-letters-wrap Referenced in:

- 5.8.1. Space Below Initial Letters
- 5.9. Initial Letter Wrapping: the initial-letters-wrap property (2)

#valdef-initial-letters-wrap-none Referenced in:

- 5.9. Initial Letter Wrapping: the initial-letters-wrap property (2) (3) (4)

#valdef-initial-letters-wrap-first Referenced in:

- 5.9. Initial Letter Wrapping: the initial-letters-wrap property (2) (3) (4) (5) (6)

#valdef-initial-letters-wrap-all Referenced in:

- 5.9. Initial Letter Wrapping: the initial-letters-wrap property