10000 csswg-drafts/css-inline/Overview.html at c868bbddc25bdeacd2b8781be665093bba3180bb · w3c/csswg-drafts · GitHub
Skip to content

Latest commit

 

History

History
executable file
·
4990 lines (3683 loc) · 183 KB

File metadata and controls

executable file
·
4990 lines (3683 loc) · 183 KB
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang=en>
<head><meta content="text/html;charset=utf-8" http-equiv=Content-Type>
<title>CSS Line Layout Module Level 3</title>
<!--
FIXME when publishing: copy the current default.css and link to
"default.css" rather than "../default.css"
-->
<link href="../default.css" rel=stylesheet type="text/css">
<link href="../csslogo.ico" rel="shortcut icon" type="image/x-icon">
<style type="text/css">
dt {font-weight: normal}
/*.issue, .note {font-style: italic}*/
.figure {font-size: smaller;}
/* Stolen from CSS2 Recommendation */
A.noxref:link, A.noxref:visited {color: black; /*color: inherit*/}
</style>
<style media=print type="text/css">
img#edge { width: 80%; height: 70%;}
dt.label { display: run-in; }
</style>
<link href="../default.css" rel=stylesheet type="text/css">
<link href="http://www.w3.org/StyleSheets/TR/W3C-ED.css" rel=stylesheet
type="text/css">
<body>
<div class=head> <!--begin-logo-->
<p><a href="http://www.w3.org/"><img alt=W3C height=48
src="http://www.w3.org/Icons/w3c_home" width=72></a> <!--end-logo-->
<h1>CSS Line Layout Module Level 3</h1>
<h2 class="no-num no-toc" id=editors>Editor's Draft 2 March 2012</h2>
<dl id=authors>
<dt>This version:
<dd><a
href="http://dev.w3.org/csswg/css3-linebox/">http://dev.w3.org/csswg/css3-linebox/</a>
<!-- <dd><a href="http://www.w3.org/TR/2012/ED-css3-linebox-20120302/">http://www.w3.org/TR/2012/ED-css3-linebox-20120302/</a> -->
<dt>Latest version:
<dd><a
href="http://www.w3.org/TR/css3-linebox/">http://www.w3.org/TR/css3-linebox/</a>
<dt>Latest editor's draft:
<dd><a
href="http://dev.w3.org/csswg/css3-linebox/">http://dev.w3.org/csswg/css3-linebox/</a>
<dt>Previous version:
<dd><a
href="http://www.w3.org/TR/2002/WD-css3-linebox-20020515/">http://www.w3.org/TR/2002/WD-css3-linebox-20020515/</a>
<dt>Issues List:
<dd><a
href="https://www.w3.org/Bugs/Public/buglist.cgi?query_format=advanced&product=CSS&component=Linebox&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED">CSS3
Line Layout issues in Bugzilla</a>
<dt>Feedback:</dt>
<dd><a href="mailto:www-style@w3.org?subject=%5Bcss-inline%5D%20feedback"
>www-style@w3.org</a>
with subject line &ldquo;<kbd>[css-inline]
<var>&hellip; message topic &hellip;</var></kbd>&rdquo;
(<a rel="discussion" href="http://lists.w3.org/Archives/Public/www-style/"
>archives</a>)
<dt>Editors:
<dd><a href="mailto:jdaggett@mozilla.com">John Daggett (Mozilla)</a>
<dd><a href="mailto:szilles@adobe.com">Steve Zilles (Adobe)</a>
<dt>Previous Editors:
<dd><a href="http://dbaron.org/">L. David Baron</a> (Mozilla Corporation)
<dd>Michel Suignard (Microsoft)
<dd><a href="http://www.meyerweb.com/eric/">Eric A. Meyer</a>
</dl>
<!--begin-copyright-->
<p class=copyright><a
href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright"
rel=license>Copyright</a> © 2012 <a href="http://www.w3.org/"><acronym
title="World Wide Web Consortium">W3C</acronym></a><sup>®</sup> (<a
href="http://www.csail.mit.edu/"><acronym title="Massachusetts Institute
of Technology">MIT</acronym></a>, <a href="http://www.ercim.eu/"><acronym
title="European Research Consortium for Informatics and
Mathematics">ERCIM</acronym></a>, <a
href="http://www.keio.ac.jp/">Keio</a>), All Rights Reserved. W3C <a
href="http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>,
<a
href="http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a>
and <a
href="http://www.w3.org/Consortium/Legal/copyright-documents">document
use</a> rules apply.</p>
<!--end-copyright-->
<hr title="Separator for header">
</div>
<h2 class="no-num no-toc" id=abstract>Abstract</h2>
<p>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 <a href="#CSS3TEXT"
rel=biblioentry>[CSS3TEXT]<!--{{CSS3TEXT}}--></a>. 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 <a href="#CSS2"
rel=biblioentry>[CSS2]<!--{{CSS2}}--></a>.
<h2 class="no-num no-toc" id=Status>Status of This Document</h2>
<!--begin-status-->
<p>This is a public copy of the editors' draft. It is provided for
di 570E scussion 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.
<p>The (<a
href="http://lists.w3.org/Archives/Public/www-style/">archived</a>) public
mailing list <a
href="mailto:www-style@w3.org?Subject=%5Bcss3-linebox%5D%20PUT%20SUBJECT%20HERE">
www-style@w3.org</a> (see <a
href="http://www.w3.org/Mail/Request">instructions</a>) is preferred for
discussion of this specification. When sending e-mail, please put the text
“css3-linebox” in the subject, preferably like this:
“[<!---->css3-linebox<!---->] <em>…summary of comment…</em>”
<p>This document was produced by the <a href="/Style/CSS/members">CSS
Working Group</a> (part of the <a href="/Style/">Style Activity</a>).
<p>This document was produced by a group operating under the <a
href="/Consortium/Patent-Policy-20040205/">5 February 2004 W3C Patent
Policy</a>. W3C maintains a <a href="/2004/01/pp-impl/32061/status"
rel=disclosure>public list of any patent disclosures</a> 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 <a
href="/Consortium/Patent-Policy-20040205/#def-essential">Essential
Claim(s)</a> must disclose the information in accordance with <a
href="/Consortium/Patent-Policy-20040205/#sec-Disclosure">section 6 of the
W3C Patent Policy</a>.</p>
<!--end-status-->
<p>This document may be available in translations in the future. The
English version of this specification is the only normative version.
<h2 class="no-num no-toc" id=Contents>Contents</h2>
<!--begin-toc-->
<ul class=toc>
<li><a href="#dependencies"><span class=secno>1 </span>Dependencies on
other modules</a>
<li><a href="#conformance"><span class=secno>2 </span>Conformance</a>
<li><a href="#LineBox"><span class=secno>3 </span>Line box, Line stacking
and Content height</a>
<ul class=toc>
<li><a href="#InlineFormatting"><span class=secno>3.1 </span>Inline
formatting context</a>
<li><a href="#LineBoxWrapping"><span class=secno>3.2
</span>Inline-progression: Line Box wrapping</a>
<li><a href="#inline1"><span class=secno>3.3 </span>Block-progression
dimensions: the <span class=property>‘<code
class=property>text-height</code>’</span> property</a>
<li><a href="#LineBoxHeight"><span class=secno>3.4 </span>Block
progression positioning and spacing</a>
<ul class=toc>
<li><a href="#InlineBoxHeight"><span class=secno>3.4.1 </span>Line
height adjustment: the <span class=property>‘<code
class=property>line-height</code>’</span> property</a>
<li><a href="#LineStacking"><span class=secno>3.4.2 </span>Line
Stacking: the <span class=property>‘<code
class=property>line-box-contain</code>’</span> property</a>
</ul>
</ul>
<li><a href="#baseline"><span class=secno>4 </span>Baseline alignment</a>
<ul class=toc>
<li><a href="#FontBaseline"><span class=secno>4.1 </span>Baseline
information provided by fonts</a>
<li><a href="#AlignmentBaselineType"><span class=secno>4.2
</span>Baseline identifiers</a>
<li><a href="#BaselineAlignmentOverview"><span class=secno>4.3
</span>Overview of the baseline alignment process</a>
<li><a href="#dominant-baseline-prop"><span class=secno>4.4
</span>Dominant baseline: the <span class=property>‘<code
class=property>dominant-baseline</code>’</span> property</a>
<li><a href="#alignment-baseline-prop"><span class=secno>4.5
</span>Aligning the alignment point of an element: the <span
class=property>‘<code
class=property>alignment-baseline</code>’</span> property</a>
<li><a href="#alignment-adjust-prop"><span class=secno>4.6
</span>Setting the alignment point: the <span class=property>‘<code
class=property>alignment-adjust</code>’</span> property</a>
<li><a href="#baseline-shift-prop"><span class=secno>4.7
</span>Repositioning the dominant baseline: the <span
class=property>‘<code class=property>baseline-shift</code>’</span>
property</a>
<li><a href="#vertical-align-prop"><span class=secno>4.8 </span>Vertical
alignment: the <span class=property>‘<code
class=property>vertical-align</code>’</span> shorthand baseline
alignment property</a>
<li><a href="#inline-box-align-prop"><span class=secno>4.9 </span>Inline
box alignment: the <span class=property>‘<code
class=property>inline-box-align</code>’</span> property</a>
</ul>
<li><a href="#Initial"><span class=secno>5 </span>Initial line and Drop
initial</a>
<ul class=toc>
<li><a href="#InitialLine"><span class=secno>5.1 </span>Initial line</a>
<li><a href="#DropInitial"><span class=secno>5.2 </span>Drop Initial
overview</a>
<li><a href="#DropInitialSize"><span class=secno>5.3 </span>Sizing drop
initial, the <span class=property>‘<code
class=property>drop-initial-size</code>’</span> and the <span
class=property>‘<code
class=property>drop-initial-value</code>’</span> properties</a>
<li><a href="#DropInitialAlign"><span class=secno>5.4 </span>Aligning
drop initial: the <span class=property>‘<code
class=property>drop-initial-before-align</code>’</span>, <span
class=property>‘<code
class=property>drop-initial-before-adjust</code>’</span>, <span
class=property>‘<code
class=property>drop-initial-after-align</code>’</span> and <span
class=property>‘<code
class=property>drop-initial-after-adjust</code>’</span>
properties</a>
</ul>
<li><a href="#properties"><span class=secno>6 </span>Properties index</a>
<li><a href="#profiles"><span class=secno>7 </span>Profiles</a>
<li><a href="#glossary"><span class=secno>8 </span>Glossary</a>
<li class=no-num><a href="#BaselineUsage">Appendix A: Usage of baseline
alignment (informative)</a>
<li class=no-num><a href="#ack">Acknowledgments</a>
<li class=no-num><a href="#ref">References</a>
<ul class=toc>
<li class=no-num><a href="#normative">Normative references</a>
<li class=no-num><a href="#other">Other references</a>
</ul>
<li class=no-num><a href="#index">Index</a>
</ul>
<!--end-toc-->
<h2 id=dependencies><span class=secno>1 </span>Dependencies on other
modules</h2>
<p>This CSS3 module depends on the following other CSS3 modules:
<ul>
<li>Fonts <a href="#CSS3-FONTS"
rel=biblioentry>[CSS3-FONTS]<!--{{!CSS3-FONTS}}--></a>
<li>Text <a href="#CSS3TEXT"
rel=biblioentry>[CSS3TEXT]<!--{{!CSS3TEXT}}--></a>
<li>Syntax and grammar <a href="#CSS3SYN"
rel=biblioentry>[CSS3SYN]<!--{{!CSS3SYN}}--></a>
<li>Values and units <a href="#CSS3VAL"
rel=biblioentry>[CSS3VAL]<!--{{!CSS3VAL}}--></a>
<li>Cascade <a href="#CSS3CASCADE"
rel=biblioentry>[CSS3CASCADE]<!--{{!CSS3CASCADE}}--></a>
</ul>
<p>It has non-normative (informative) references to the following other
CSS3 modules:
<ul>
<li>Multi-column layout <a href="#CSS3COL"
rel=biblioentry>[CSS3COL]<!--{{CSS3COL}}--></a>
<li>Ruby <a href="#CSS3RUBY"
rel=biblioentry>[CSS3RUBY]<!--{{CSS3RUBY}}--></a>
</ul>
<h2 id=conformance><span class=secno>2 </span>Conformance</h2>
<p class=issue>[Add some real conformance text here.]
<p>All described properties, in addition to the noted values, take ‘<code
class=property>initial</code>’ and ‘<code
class=property>inherit</code>’. These values are not repeated in each of
the property value enumeration.
<p>This module uses extensively the ‘<code
class=property>before</code>’, ‘<code class=property>after</code>’,
‘<code class=property>start</code>’ and ‘<code
class=property>end</code>’ notation to specify the four edges of a box
relative to its text advance direction, independently of its absolute
positioning in terms of ‘<code class=property>top</code>’, ‘<code
class=property>bottom</code>’, ‘<code class=property>left</code>’
and ‘<code class=property>right</code>’ (corresponding respectively to
the ‘<code class=property>before</code>’, ‘<code
class=property>after</code>’, ‘<code class=property>start</code>’
and ‘<code class=property>end</code>’ positions in a typical Western
text layout). This notation is also used extensively in <a href="#XSL10"
rel=biblioentry>[XSL10]<!--{{XSL10}}--></a> for the same purpose.
<p>Finally, in this document, requirements are expressed using the key
words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;,
&quot;SHALL&quot; and &quot;SHALL NOT&quot;. Recommendations are expressed
using the key words &quot;SHOULD&quot;, &quot;SHOULD NOT&quot; and
&quot;RECOMMENDED&quot;. &quot;MAY&quot; and &quot;OPTIONAL&quot; are used
to indicate optional features or behavior. These keywords are used in
accordance with <a href="#RFC2119"
rel=biblioentry>[RFC2119]<!--{{!RFC2119}}--></a>. For legibility these
keywords are used in lowercase form.
<h2 id=LineBox><span class=secno>3 </span>Line box, Line stacking and
Content height</h2>
<p>This section describes inline boxes formatting, how lines are stacked
together and a mechanism to adjust the content height of inline elements.
Two terms: inline-progression dimension and block-progression dimension
are used frequently in the section and are defined as follows
<p>The <b>inline-progression dimension</b> is a length in the direction of
the inline-progression of a box. For an horizontal layout flow it can be
perceived as related to the the width of the box. However for a vertical
layout flow it will be related to the height of the box. The term
inline-progression dimension is the neutral way to express that dimension
independently of the layout flow.
<p>The <b>block-progression dimension</b> is a length in the direction of
the block-progression of a box. For an horizontal layout flow it can be
perceived as related to the height of the box. However for a vertical
layout flow it will be related to the width of the box. The term
block-progression dimension is the neutral way to express that dimension
independently of the layout flow.
<h3 id=InlineFormatting><span class=secno>3.1 </span>Inline formatting
context</h3>
<p>In an inline formatting context, boxes are laid out in the
inline-progression direction, one after the other, following the
block-progression within the containing block. Borders, padding and
inline-progression margins are respected between these boxes. The boxes
may be aligned within the inline-progression in different ways: their
after-edges or before-edges may be aligned, or the baselines of text
within them may be aligned. The rectangular area that contains the boxes
that form a line is called a <a class=index-def href="#line-box0" id=x
title="line box"> </a><a id=line-box><dfn id=line-box0>line box</dfn></a>.
<p>The inline-progression dimension (‘<code
class=property>width</code>’ in horizontal flow) of a line box is
determined by its containing block. The block-progression dimension
(‘<code class=property>height</code>’ in horizontal flow) of a line
box is determined by the rules given in the section on <a
href="#line-height">line height calculations</a>. A line box is generally
tall (relative) enough for all of the boxes it contains. However, it may
be taller than the tallest box it contains (if, for example, boxes are
aligned so that baselines line up). The alignment of boxes within a line
box is determined by the <a href="#baseline">baseline alignment</a>
properties.
<p>In general, when several inline boxes cannot fit within a single line
box, they are distributed among two or more block-progression stacked line
boxes. The exact wrapping of inline boxes at the line ending edge is
determined by several text related property categories such as
line-breaking, word-breaking, text wrapping and white-space management.
Thus, a paragraph is a stack of line boxes.
<p>Line boxes are stacked together in the block-progression direction
without any separation. The block-progression dimension of the line box is
determined by the contents of the line box (including the root inline box)
and the <span class=property>‘<code class=property><a
href="#line-box-contain">line-box-contain</a></code>’</span> property.
<p>A containing block defines a <b>root inline box</b> which wraps all the
inline children of the block element, including the anonymous inline
boxes. It inherits inheritable properties from the parent block box (like
<span class=property>‘<code class=property><a
href="#line-height">line-height</a></code>’</span>), while non-inherited
properties have their default values. The root inline box establishes a
baseline for vertical alignment and may affect the height of the line
boxes.
<p>Although margins, borders, and padding of non-replaced elements do not
enter into inline box block-progression dimension calculation (and thus
the line box calculation), they are still rendered around inline boxes.
This means that if the block-progression dimension of a line box is
shorter than the <a
href="http://www.w3.org/TR/REC-CSS2/box.html#outer-edge">outer edges</a>
of the boxes it contains, backgrounds and colors of padding and borders
may &quot;bleed&quot; into adjacent line boxes. However, in this case,
some user agents may use the line box to &quot;clip&quot; the border and
padding areas (i.e., not render them).
<h3 id=LineBoxWrapping><span class=secno>3.2 </span>Inline-progression:
Line Box wrapping</h3>
<p>In general, the start edge of a line box touches the start edge of its
containing block and the end edge touches the end edge of its containing
block. However, floating boxes may come between the containing block edge
and the line box edge. Thus, although line boxes in the same inline
formatting context generally have the same inline-progression dimension
(that of the containing block), they may vary if available
inline-progression space is reduced due to <!-- a href="#floats"-->
floats<!--/a-->. Line boxes in the same inline formatting context may vary
in block-progression dimension.
<p>When the total inline-progression dimension of the inline boxes on a
line is less than the inline-progression dimension of the line box
containing them, their inline-progression distribution within the line box
is determined by the <span class=property>‘<code class=property><a
href="#text-align">text-align</a></code>’</span> property. If that
property has the value ‘<code class=property>justify</code>’, the user
agent may stretch the inline boxes as well.
<p>When line-breaking opportunities are available within inline boxes and
are not pre-empted by the white-space properties, the inline boxes located
at the ending edge of the line box may be split into se 6910 veral boxes and
these boxes distributed across several line boxes. When an inline box is
split, margins, borders, and padding have no visual effect where the split
occurs (or at any split, when they are several). Formatting of margins,
borders, and padding may not be fully defined if the split occurs within a
bidirectional embedding.
<p>Inline boxes may also be split into several boxes <em>within the same
line box</em> due to <a href="#direction">bidirectional text
processing</a>.
<div class=html-example> Here is an example of inline box construction. The
following paragraph (created by the HTML block-level element P) contains
anonymous text interspersed with the elements EM and STRONG:
<pre>&lt;P&gt;Several &lt;EM&gt;emphasized words&lt;/EM&gt; appear
&lt;STRONG&gt;in this&lt;/STRONG&gt; sentence, dear.&lt;/P&gt;
</pre>
<p>The P element generates a block box that contains five inline boxes,
three of which are anonymous:</p>
<ul>
<li>Anonymous: &quot;Several&quot;
<li>EM: &quot;emphasized words&quot;
<li>Anonymous: &quot;appear&quot;
<li>STRONG: &quot;in this&quot;
<li>Anonymous: &quot;sentence, dear.&quot;
</ul>
<p>To format the paragraph, the user agent flows the five boxes into line
boxes. In this example, the box generated for the P element establishes
the containing block for the line boxes. If the containing block is
sufficiently wide (relative) , all the inline boxes will fit into a
single line box:</p>
<pre> Several <em>emphasized words</em> appear <strong>in this</strong> sentence, dear.
</pre>
<p>If not, the inline boxes will be split up and distributed across
several line boxes. The previous paragraph might be split as follows:</p>
<pre>Several <em>emphasized words</em> appear
<strong>in this</strong> sentence, dear.
</pre>
<p>or like this:</p>
<pre>Several <em>emphasized</em>
<em>words</em> appear <strong>in this</strong>
sentence, dear.
</pre>
</div>
<p>In the previous example, the EM box was split into two EM boxes (call
them &quot;split1&quot; and &quot;split2&quot;). Margins, borders,
padding, or text decorations have no visible effect after split1 or before
split2.
<div class=html-example> Consider the following example:
<pre>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot;&gt;
&lt;HTML&gt;
&lt;HEAD&gt;
&lt;TITLE&gt;Example of inline flow on several lines&lt;/TITLE&gt;
&lt;STYLE type=&quot;text/css&quot;&gt;
EM {
padding: 2px;
margin: 1em;
border-width: medium;
border-style: dashed;
line-height: 2.4em;
}
&lt;/STYLE&gt;
&lt;/HEAD&gt;
&lt;BODY&gt;
&lt;P&gt;Several &lt;EM&gt;emphasized words&lt;/EM&gt; appear here.&lt;/P&gt;
&lt;/BODY&gt;
&lt;/HTML&gt;
</pre>
<p>Depending on the width of the P, the boxes may be distributed as
follows:</p>
<div class=figure> <img alt="Image illustrating the effect of line
breaking on the display of margins, borders, and padding." height=99
src=inline-layout.gif width=260><span class=dlink>   <a
href="http://www.w3.org/TR/REC-CSS2/images/longdesc/inline-layout-desc.html"
name=img-inline-layout title="Long description for illustration of
margin/border behavior on split inline box">[D]</a></span></div>
<ul>
<li>The margin is inserted before &quot;emphasized&quot; and after
&quot;words&quot;.
<li>The padding is inserted before, above, and below
&quot;emphasized&quot; and after, above, and below &quot;words&quot;. A
dashed border is rendered on three sides in each case.
</ul>
</div>
<h3 id=inline1><span class=secno>3.3 </span>Block-progression dimensions:
the <span class=property>‘<code class=property><a
href="#text-height">text-height</a></code>’</span> property</h3>
<p>Each inline box has a block-progression dimension which is derived from
the following parameters: the ‘<code class=property><a
href="#text-height">text-height</a></code>’ and ‘<code
class=property><a href="#font-size">font-size</a></code>’ properties for
non-replaced elements, the height or the width for replaced elements
(depending on the text flow being horizontal or vertical respectively) and
the stacked block-progression dimension for inline-block elements
(identical to what is done for block-level elements).
<p>The block-progression dimension determines the position of the padding,
border and margin for the element but does not necessarily determine the
line stacking progression as this is also affected by the ‘<code
class=property><a href="#line-box-contain">line-box-contain</a></code>’
property.
<table class=propdef id=nametext-height>
<tbody>
<tr>
<td><em>Name:</em>
<td><dfn id=text-height>text-height</dfn>
<tr>
<td><em>Value:</em>
<td>auto | font-size | text-size | max-size | &lt;number&gt;
<tr>
<td><em>Initial:</em>
<td>auto
<tr>
<td><em>Applies to:</em>
<td>inline elements and parents of element with display:ruby-text
<tr>
<td><em>Inherited:</em>
<td>yes
<tr>
<td><em>Percentages:</em>
<td>N/A
<tr>
<td><em>Media:</em>
<td>visual
<tr>
<td><em>Computed value:</em>
<td>specified value (except for initial and inherit)
</table>
<p>The ‘<code class=property><a
href="#text-height">text-height</a></code>’ property determine the
block-progression dimension of the text content area of an inline box
(non-replaced elements) . Possible values:
<dl>
<dt><strong>auto</strong>
<dd>The block-progression dimension is based either on the em square
determined by the computed element font-size property value or the
cell-height (ascender + descender) related to the computed element
font-size as chosen by the user agent.
<dt>font-size
<dd>The block-progression dimension is based on the em square as
determined by the computed element font-size.
<dt>text-size
<dd>The block-progression dimension is based on the cell-height (ascender
+ descender) related to the computed element font-size.
<dt>max-size
<dd>The block-progression dimension is based on the maximum extents toward
the before-edge and after-edge of the box obtained by considering all
children elements located on the same line, ruby annotations (elements
with ‘<code class=css>display:ruby-text</code>’) and baseline shifted
elements.
<dt>&lt;number&gt;
<dd>The block progression dimension is based on &lt;number&gt; times the
em square as determined by the computed font-size.
</dl>
<p>When more than one font-size is used (this could happen when glyphs are
found in different fonts), it is recommended that the largest font-size
provides the em square and the cell-height.
<p>Although the ‘<code class=property><a
href="#text-height">text-height</a></code>’ property does not apply
directly to block elements, it applies to their anonymous children inline
boxes (if any).
<p>For replaced elements, the block-progression dimension is determined by
the outer edges (i.e. margin edge).
<h3 id=LineBoxHeight><span class=secno>3.4 </span>Block progression
positioning and spacing</h3>
<h4 id=InlineBoxHeight><span class=secno>3.4.1 </span>Line height
adjustment: the <span class=property>‘<code class=property><a
href="#line-height">line-height</a></code>’</span> property</h4>
<p>The ‘<code class=property><a
href="#line-height">line-height</a></code>’ property controls the amount
of leading space which is added before and after the block-progression
dimension of an inline box (not including replaced inline boxes, but
including the root inline box) to determine the extended block-progression
dimension of the inline box. The value of the ‘<code class=property><a
href="#line-box-contain">line-box-contain</a></code>’ property
determines how the block-progression dimension and the extended
block-progression dimension affect the height of the line box. The sum of
the possible leading space and the block-progression dimension is called
the <b>extended block-progression dimension</b>. That extended value is
not used for border, margin and padding placement but is used for vertical
alignment (relative) and line box block-progression dimension.
<p>The <span class=index-def id=leading title=leading><em><a
name=x15>leading</a></em></span><span title=leading> for an inline
non-replaced element is defined as the d</span>ifference between the
block-progression dimension as determined by the ‘<code
class=property><a href="#text-height">text-height</a></code>’ property
and the computed value of <span class=property>‘<code class=property><a
href="#line-height">line-height</a></code>’</span>. Half the leading is
called the <a class=index-def href="#half-leading" id=half-leading0
title=half-leading><em><a name=x16> half-leading</a></em></a>, each
half-leading is located before and after the block-progression dimension
of the element. The ‘<code class=property><a
href="#line-height">line-height</a></code>’ value will specify the
<em>exact</em> extended block-progression dimension of each box generated
by the element. (Depending on the value of ‘<code class=property><a
href="#line-box-contain">line-box-contain</a></code>’, the extended
block-progression dimension may be ignored.) (For inline <a
href="http://www.w3.org/TR/REC-CSS2/conform.html#replaced-element">replaced</a>
elements, both the block-progression dimension and the extended
block-progression dimension of the box are given by the outer edges (i.e.
margin edge).) Anonymous inline boxes use the ‘<code class=property><a
href="#text-height">text-height</a></code>’ and ‘<code
class=property><a href="#line-height">line-height</a></code>’ property
values specified for their parent.
<p>Depending on the value of the ‘<code class=property><a
href="#line-stacking-strategy">line-stacking-strategy</a></code>’, the
‘<code class=property><a href="#line-height">line-height</a></code>’
value may provide a minimum or exact extended block-progression dimension
for each generated inline box and the line boxes. How the leading space is
distributed between the before-edge and the after-edge of inline elements
within the line box depends on their vertical-align property value. <span
class=issue>[LDB: I don't understand this paragraph.]</span>
<p>Empty inline elements generate empty inline boxes, but these boxes still
have a line height, and thus may influence the line box block-progression
dimension, as if the empty box contained an infinitely narrow letter.
<p>A inline box which otherwise would influence the line box extended
progression dimension may be removed from the computation by using a
special value of the line-height property: ‘<code
class=property>none</code>’.
<table class=propdef id=name-62>
<tbody>
<tr>
<td><em>Name:</em>
<td><dfn id=line-height>line-height</dfn>
<tr>
<td><em>Value:</em>
<td>normal | <a class=noxref
href="http://www.w3.org/TR/REC-CSS2/syndata.html#value-def-number">
<span class=value-inst-number>&lt;number&gt;</span></a> | <a
class=noxref
href="http://www.w3.org/TR/REC-CSS2/syndata.html#value-def-length">
<span class=value-inst-length>&lt;length&gt;</span></a> | <a
class=noxref
href="http://www.w3.org/TR/REC-CSS2/syndata.html#value-def-percentage">
<span class=value-inst-percentage>&lt;percentage&gt;</span></a> | none
<tr>
<td><em>Initial:</em>
<td>normal
<tr>
<td><em>Applies to:</em>
<td>all elements
<tr>
<td><em>Inherited:</em>
<td>yes
<tr>
<td><em>Percentages:</em>
<td>refer to the font size of the element itself
<tr>
<td><em>Media:</em>
<td><a class=noxref
href="/TR/REC-CSS2/media.html#visual-media-group">visual</a>
<tr>
<td><em>Computed value:</em>
<td>see prose
</table>
<p>Values for this property have the following meanings:
<dl>
<dt><strong>normal</strong>
<dd>Tells user agents to set the <a
href="http://www.w3.org/TR/REC-CSS2/cascade.html#computed-value">computed
value</a> to a &quot;reasonable&quot; value based on the font size of the
element. The value has the same meaning as <span class=index-inst
id=ltnumbergt title="&lt;number&gt;"> <a class=noxref
href="http://www.w3.org/TR/REC-CSS2/syndata.html#value-def-number"
name=x18> <span class=value-inst-number>&lt;number&gt;</span></a></span>.
We recommend a computed value for ‘<code
class=property>normal</code>’ between 1.0 to 1.2. The user agent may
allow the &lt;number&gt; to vary depending on the metrics of the font(s)
being used.
<dt><span class=index-inst id=ltlengthgt0 title="&lt;length&gt;"> <a
class=noxref
href="http://www.w3.org/TR/REC-CSS2/syndata.html#value-def-length"
name=x19> <span
class=value-inst-length><strong>&lt;length&gt;</strong></span></a></span>
<dd>The box height is set to this length. Negative values are illegal. The
length is the computed value.
<dt><span class=index-inst id=ltnumbergt0 title="&lt;number&gt;"> <a
class=noxref
href="http://www.w3.org/TR/REC-CSS2/syndata.html#value-def-number"
name=x20> <span
class=value-inst-number><strong>&lt;number&gt;</strong></span></a></span>
<dd>The <a
href="http://www.w3.org/TR/REC-CSS2/cascade.html#computed-value">
computed value</a> of the property is this number multiplied by the
element's font size. Negative values are illegal. However, the number,
not the <a
href="http://www.w3.org/TR/REC-CSS2/cascade.html#computed-value">computed
value</a>, is inherited.
<dt><span class=index-inst id=ltpercentagegt0 title="&lt;percentage&gt;">
<a class=noxref
href="http://www.w3.org/TR/REC-CSS2/syndata.html#value-def-percentage"
name=x21> <span
class=value-inst-percentage><strong>&lt;percentage&gt;</strong></span></a></span>
<dd>The <a
href="http://www.w3.org/TR/REC-CSS2/cascade.html#computed-value">
computed value</a> of the property is this percentage multiplied by the
element's computed font size. Negative values are illegal.
<dt>none
<dd>For inline-level elements, the element does not influence the
<i>extended block-progression dimension</i> of the line. The computed
value is the specified value (‘<code class=property>none</code>’).
For block-level elements, equivalent to ‘<code
class=property>normal</code>’ (and the computed value is ‘<code
class=property>normal</code>’). <span class=issue>This definition
should be briefer, and should refer to the next section.</span>
</dl>
<div class=example>
<p style="DISPLAY: none">Example(s):</p>
<p>The three rules in the example below have the same resultant line
height:</p>
<pre>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 */
</pre>
</div>
<p>When an element contains text that is rendered in more than one font,
user agents should determine the <span class=property>‘<code
class=property><a href="#line-height">line-height</a></code>’</span>
value according to the largest font size (when appropriate).
<p>Note that replaced elements have a <span class=property>‘<code
class=property><a href="#font-size">font-size</a></code>’</span> and a
<span class=property>‘<code class=property><a
href="#line-height">line-height</a></code>’</span> property, even if
they are not used directly to determine the extended block-progression
dimension of the box: ‘<code class=property>em</code>’ and ‘<code
class=property>ex</code>’ values are relative to values of ‘<code
class=property><a href="#font-size">font-size</a></code>’ and percentage
values for <span class=property>‘<code class=property><a
href="#vertical-align">vertical-align</a></code>’</span> are relative to
values of the extended block-progression dimension. <span
class=issue>[LDB: The second part of this sentence is a significant change
from CSS2, and also doesn't mauke senes in the context of the
sentence.]</span>
<p>When the <span class=property>‘<code class=property><a
href="#line-height">line-height</a></code>’</span> value is less than
the font size, the final inline box extended block-progression dimension
will be less than the font size and the rendered glyphs will
&quot;bleed&quot; outside the box. If such a box touches the edge of a
line box, the rendered glyphs will also &quot;bleed&quot; into the
adjacent line box.
<h4 id=LineStacking><span class=secno>3.4.2 </span>Line Stacking: the <span
class=property>‘<code class=property><a
href="#line-box-contain">line-box-contain</a></code>’</span> property</h4>
<table class=propdef id=name-30>
<tbody>
<tr>
<td><em>Name:</em>
<td><dfn id=line-box-contain>line-box-contain</dfn>
<tr>
<td><em>Value:</em>
<td>[ block || inline || font || glyphs || replaced || inline-box ] |
none | inherit | initial
<tr>
<td><em>Initial:</em>
<td>block inline replaced
<tr>
<td><em>Applies to:</em>
<td>block-level elements
<tr>
<td><em>Inherited:</em>
<td>yes
<tr>
<td><em>Percentages:</em>
<td>N/A
<tr>
<td><em>Media:</em>
<td>visual
<tr>
<td><em>Computed value:</em>
<td>specified value (except for ‘<code
class=property>inherit</code>’ and ‘<code
class=property>initial</code>’)
</table>
<p>This property enumerates which aspects of the elements in a line box
contribute to the height height of that line box.
<dl>
<dt>block
<dd>The extended block progression dimension of the root inline box must
fit within the line box.
<dt>inline
<dd>The extended block progression dimension of all non-replaced inline
boxes whose ‘<code class=property><a
href="#line-height">line-height</a></code>’ is not ‘<code
class=property>none</code>’ in the line box must fit within the line
box.
<dt>font
<dd>The block progression dimension of all non-replaced inline boxes in
the line whose ‘<code class=property><a
href="#line-height">line-height</a></code>’ is not ‘<code
class=property>none</code>’ that directly (i.e., within the box but not
within one of its descendants) contain non-removed text must fit within
the line box, where non-removed text is any characters not removed based
on the values of the ‘<code
class=property>linefeed-treatment</code>’, ‘<code
class=property>white-space-treatment</code>’, and ‘<code
class=property>all-space-treatment</code>’ properties. <span
class=issue>[LDB: This isn't quite right. What about zwnj, etc.?</span>
<dt>glyphs
<dd>The block progression dimension of all the glyph bounding boxes of
glyphs in the line box must fit within the line box.
<dt>replaced
<dd>The margin box of all <span title="replaced element"><a
href="#replaced">replaced elements</a></span> within the line must fit
within the line box.
<dt>inline-box
<dd>The margin-box of all non-replaced inline elements in the line whose
‘<code class=property><a href="#line-height">line-height</a></code>’
is not ‘<code class=property>none</code>’ must fit within the line
box. <span class=issue>Should this split into ‘<code
class=property>inline-border</code>’ and ‘<code
class=property>inline-margin</code>’?</span>
</dl>
<p>If the property has no value for all elements within a line, then the
line box has 0 height, and the line within the anonymous inline
established by the block that coincides with the line block is the
baseline of that anonymous inline block (or should it be determined by the
‘<code class=property><a
href="#vertical-align">vertical-align</a></code>’ property of the
block?). <span class=issue>[This is arbitrary. Does anyone have better
ideas?]</span>
<p class=note>Note that the CSS2 model is equivalent to ‘<code