10BC0 csswg-drafts/css-inline/Overview.html at efd65978dd43aa983571fe908738cf9272149d13 · xfq/csswg-drafts · GitHub
Skip to content

Latest commit

 

History

< E417 /span>History
1356 lines (1349 loc) · 115 KB

File metadata and controls

1356 lines (1349 loc) · 115 KB
<!doctype html><html lang="en">
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<title>CSS Inline Layout Module Level 3</title>
<meta content="exploring" name="csswg-work-status">
<meta content="ED" name="w3c-status">
<link href="../default.css" rel="stylesheet" type="text/css">
<link href="../csslogo.ico" rel="shortcut icon" type="image/x-icon">
<style>
body {
background: url("https://www.w3.org/StyleSheets/TR/logo-ED") top left no-repeat white;
background-attachment: fixed;
color: black;
font-family: sans-serif;
margin: 0 auto;
max-width: 50em;
padding: 2em 1em 2em 70px;
}
:link { color: #00C; background: transparent }
:visited { color: #609; background: transparent }
a[href]:active { color: #C00; background: transparent }
a[href]:hover { background: #ffa }
a[href] img { border-style: none }
h1, h2, h3, h4, h5, h6 { text-align: left }
h1, h2, h3 { color: #005A9C; }
h1 { font: 170% sans-serif }
h2 { font: 140% sans-serif }
h3 { font: 120% sans-serif }
h4 { font: bold 100% sans-serif }
h5 { font: italic 100% sans-serif }
h6 { font: small-caps 100% sans-serif }
.hide { display: none }
div.head { margin-bottom: 1em }
div.head h1 { margin-top: 2em; clear: both }
div.head table { margin-left: 2em; margin-top: 2em }
p.copyright { font-size: small }
p.copyright small { font-size: small }
pre { margin-left: 2em }
dt { font-weight: bold }
ul.toc, ol.toc {
list-style: none;
}
</style>
<meta content="Bikeshed 1.0.0" name="generator">
<style media="print" type="text/css">
img#edge { width: 80%; height: 70%;}
dt.label { display: run-in; }
</style>
</head>
<body class="h-entry">
<div class="head">
<p data-fill-with="logo"><a class="logo" href="http://www.w3.org/"> <img alt="W3C" height="48" src="https://www.w3.org/Icons/w3c_home" width="72"> </a> </p>
<h1 class="p-name no-ref" id="title">CSS Inline Layout Module Level 3</h1>
<h2 class="no-num no-toc no-ref heading settled" id="subtitle"><span class="content">Editor’s Draft, <time class="dt-updated" datetime="2015-09-13">13 September 2015</time></span></h2>
<div data-fill-with="spec-metadata">
<dl>
<dt>This version:
<dd><a class="u-url" href="http://dev.w3.org/csswg/css-inline/">http://dev.w3.org/csswg/css-inline/</a>
<dt>Latest version:
<dd><a href="http://www.w3.org/TR/css-inline/">http://www.w3.org/TR/css-inline/</a>
<dt>Previous Versions:
<dd><a href="http://www.w3.org/TR/2002/WD-css3-linebox-20020515/" rel="previous">http://www.w3.org/TR/2002/WD-css3-linebox-20020515/</a>
<dt>Feedback:
<dd><span><a href="mailto:www-style@w3.org?subject=%5Bcss-inline%5D%20YOUR%20TOPIC%20HERE">www-style@w3.org</a> with subject line “<kbd>[css-inline] <var>… message topic …</var></kbd>” (<a href="http://lists.w3.org/Archives/Public/www-style/" rel="discussion">archives</a>)</span>
<dt>Issue Tracking:
<dd><a href="https://github.com/w3c/csswg-drafts/issues/">GitHub</a>
<dd><a href="#issues-index">Inline In Spec</a>
<dt class="editor">Editors:
<dd class="editor p-author h-card vcard"><a class="p-name fn u-email email" href="mailto:dauwhe@gmail.com">Dave Cramer</a> (<span class="p-org org">Hachette Livre</span>)
<dd class="editor p-author h-card vcard"><a class="p-name fn u-url url" href="http://fantasai.inkedblade.net/contact">Elika J. Etemad / fantasai</a> (<span class="p-org org">Invited Expert</span>)
<dd class="editor p-author h-card vcard"><a class="p-name fn u-email email" href="mailto:szilles@adobe.com">Steve Zilles</a> (<span class="p-org org">Adobe</span>)
<dt>Issues list:
<dd><span><a href="https://www.w3.org/Bugs/Public/buglist.cgi?query_format=advanced&amp;product=CSS&amp;component=Linebox&amp;bug_status=NEW&amp;bug_status=ASSIGNED&amp;bug_status=REOPENED">CSS3 Line Layout issues in Bugzilla</a></span>
</dl>
</div>
<div data-fill-with="warning"></div>
<p class="copyright" data-fill-with="copyright"><a href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright">Copyright</a> © 2015 <a href="http://www.w3.org/"><abbr title="World Wide Web Consortium">W3C</abbr></a><sup>®</sup> (<a href="http://www.csail.mit.edu/"><abbr title="Massachusetts Institute of Technology">MIT</abbr></a>, <a href="http://www.ercim.eu/"><abbr title="European Research Consortium for Informatics and Mathematics">ERCIM</abbr></a>, <a href="http://www.keio.ac.jp/">Keio</a>, <a href="http://ev.buaa.edu.cn/">Beihang</a>). 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>
<hr title="Separator for header">
</div>
<h2 class="no-num no-toc no-ref heading settled" id="abstract"><span class="content">Abstract</span></h2>
<div class="p-summary" data-fill-with="abstract">
<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 data-link-type="biblio" href="#biblio-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 data-link-type="biblio" href="#biblio-css2">[CSS2]</a>.</p>
<a href="http://www.w3.org/TR/CSS/">CSS</a> is a language for describing the rendering of structured documents
(such as HTML and XML)
on screen, on paper, in speech, etc.
</div>
<h2 class="no-num no-toc no-ref heading settled" id="status"><span class="content">Status of this document</span></h2>
<div data-fill-with="status">
<p> 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. </p>
<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=%5Bcss-inline%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 “css-inline” in the subject,
preferably like this:
“[css-inline] <em>…summary of comment…</em>” </p>
<p> This document was produced by the <a href="http://www.w3.org/Style/CSS/members">CSS Working Group</a> (part of the <a href="http://www.w3.org/Style/">Style Activity</a>). </p>
<p> This document was produced by a group operating under
the <a href="http://www.w3.org/Consortium/Patent-Policy-20040205/">5 February 2004 W3C Patent Policy</a>.
W3C maintains a <a href="http://www.w3.org/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="http://www.w3.org/Consortium/Patent-Policy-20040205/#def-essential">Essential Claim(s)</a> must disclose the information in accordance with <a href="http://www.w3.org/Consortium/Patent-Policy-20040205/#sec-Disclosure">section 6 of the W3C Patent Policy</a>. </p>
<p> This document is governed by the <a href="http://www.w3.org/2014/Process-20140801/" id="w3c_process_revision">1 August 2014 W3C Process Document</a>. </p>
<p></p>
</div>
<div data-fill-with="at-risk">
<p>The following features are at-risk, and may be dropped during the CR period: </p>
<ul>
<li>the <a class="property" data-link-type="propdesc" href="#propdef-initial-letter-wrap">initial-letter-wrap</a> property
</ul>
<p>“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 difficulting 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.</p>
</div>
<h2 class="no-num no-toc no-ref heading settled" id="contents"><span class="content">Table of Contents</span></h2>
<div data-fill-with="table-of-contents" role="navigation">
<ul class="toc" role="directory">
<li>
<a href="#line-height"><span class="secno">1</span> <span class="content">Line Heights and Baseline Alignment</span></a>
<ul class="toc">
<li><a href="#dominant-baseline property"><span class="secno">1.1</span> <span class="content"> Dominant Baselines: the <span class="property">dominant-baseline</span> property</span></a>
<li>
<a href="#transverse-alignment"><span class="secno">1.2</span> <span class="content"> Transverse Box Alignment: the <span class="property">vertical-align</span> property</span></a>
<ul class="toc">
<li><a href="#alignment-baseline-property"><span class="secno">1.2.1</span> <span class="content"> Alignment Point: <span class="property">alignment-baseline</span> longhand</span></a>
<li><a href="#baseline-shift-property"><span class="secno">1.2.2</span> <span class="content"> Alignment Shift: <span class="property">baseline-shift</span> longhand</span></a>
</ul>
</ul>
<li>
<a href="#initial-letter-styling"><span class="secno">2</span> <span class="content"> Initial Letters</span></a>
<ul class="toc">
<li>
<a href="#initial-letter-intro"><span class="secno">2.1</span> <span class="content"> An Introduction to Initial Letters</span></a>
<ul class="toc">
<li><a href="#drop-initial"><span class="secno">2.1.1</span> <span class="content"> Drop Initial</span></a>
<li><a href="#sunk-initial"><span class="secno">2.1.2</span> <span class="content"> Sunken Initial Letters</span></a>
<li><a href="#raise-initial"><span class="secno">2.1.3</span> <span class="content"> Raised Initial Letters</span></a>
</ul>
<li><a href="#selecting-drop-initials"><span class="secno">2.2</span> <span class="content">Selecting Initial Letters</span></a>
<li>
<a href="#sizing-drop-initials"><span class="secno">2.3</span> <span class="content"> Creating Initial Letters: the <span class="property">initial-letter</span> property</span></a>
<ul class="toc">
<li><a href="#initial-letter-properties"><span class="secno">2.3.1</span> <span class="content"> Properties</span></a>
<li><a href="#initial-letter-model"><span class="secno">2.3.2</span> <span class="content"> Layout Model</span></a>
<li><a href="#initial-letter-box"><span class="secno">2.3.3</span> <span class="content"> Content-box Size, Margins, Borders, and Padding</span></a>
</ul>
<li>
<a href="#aligning-initial-letter"><span class="secno">2.4</span> <span class="content"> Alignment of Initial Letters: the <span class="property">initial-letter-align</span> property</span></a>
<ul class="toc">
<li><a href="#initial-letter-align-defaults"><span class="secno">2.4.1</span> <span class="content"> UA Default Stylesheet for <span class="property">initial-letter-align</span></span></a>
</ul>
<li>
<a href="#sizing-initial-letters"><span class="secno">2.5</span> <span class="content"> Sizing Initial Letters</span></a>
<ul class="toc">
<li><a href="#initial-letter-shaping"><span class="secno">2.5.1</span> <span class="content"> Shaping and Glyph Selection</span></a>
</ul>
<li><a href="#initial-letter-exclusions"><span class="secno">2.6</span> <span class="content"> Space Around Initial Letters</span></a>
<li><a href="#initial-letter-position"><span class="secno">2.7</span> <span class="content"> Positioning and Kerning Initial Letters</span></a>
<li><a href="#initial-letter-wrapping"><span class="secno">2.8</span> <span class="content"> Initial Letter Wrapping: the <span class="property">initial-letter-wrap</span> property</span></a>
<li><a href="#initial-letter-indentation"><span class="secno">2.9</span> <span class="content"> Indentation and Multi-line Effects</span></a>
<li>
<a href="#initial-letter-paragraphs"><span class="secno">2.10</span> <span class="content"> Clearing Initial Letters</span></a>
<ul class="toc">
<li><a href="#raised-sunken-caps"><span class="secno">2.10.1</span> <span class="content"> Raised and sunken caps</span></a>
<li><a href="#short-para-initial-letter"><span class="secno">2.10.2</span> <span class="content"> Short paragraphs with initial letters</span></a>
<li><a href="#initial-letter-floats"><span class="secno">2.10.3</span> <span class="content"> Interaction with floats</span></a>
</ul>
</ul>
<li>
<a href="#baseline-synthesis"><span class="secno"></span> <span class="content"> Appendix A: Synthesizing Baselines</span></a>
<ul class="toc">
<li><a href="#baseline-synthesis-fonts"><span class="secno"></span> <span class="content"> A.1: Synthesizing Baselines for Text</span></a>
<li><a href="#baseline-synthesis-replaced"><span class="secno"></span> <span class="content"> A.2: Synthesizing Baselines for Replaced Content</span></a>
</ul>
<li><a href="#ack"><span class="secno"></span> <span class="content"> Acknowledgments</span></a>
<li>
<a href="#conformance"><span class="secno"></span> <span class="content"> Conformance</span></a>
<ul class="toc">
<li><a href="#conventions"><span class="secno"></span> <span class="content"> Document conventions</span></a>
<li><a href="#conformance-classes"><span class="secno"></span> <span class="content"> Conformance classes</span></a>
<li><a href="#partial"><span class="secno"></span> <span class="content"> Partial implementations</span></a>
<li><a href="#experimental"><span class="secno"></span> <span class="content"> Experimental implementations</span></a>
<li><a href="#testing"><span class="secno"></span> <span class="content"> Non-experimental implementations</span></a>
</ul>
<li>
<a href="#index"><span class="secno"></span> <span class="content">Index</span></a>
<ul class="toc">
<li><a href="#index-defined-here"><span class="secno"></span> <span class="content">Terms defined by this specification</span></a>
<li><a href="#index-defined-elsewhere"><span class="secno"></span> <span class="content">Terms defined by reference</span></a>
</ul>
<li>
<a href="#references"><span class="secno"></span> <span class="content">References</span></a>
<ul class="toc">
<li><a href="#normative"><span class="secno"></span> <span class="content">Normative References</span></a>
<li><a href="#informative"><span class="secno"></span> <span class="content">Informative References</span></a>
</ul>
<li><a href="#property-index"><span class="secno"></span> <span class="content">Property Index</span></a>
<li><a href="#issues-index"><span class="secno"></span> <span class="content">Issues Index</span></a>
</ul>
</div>
<main>
<h2 class="heading settled" data-level="1" id="line-height"><span class="secno">1. </span><span class="content">Line Heights and Baseline Alignment</span><a class="self-link" href="#line-height"></a></h2>
<p class="issue" id="issue-1a1ecd92"><a class="self-link" href="#issue-1a1ecd92"></a>This section is being rewritten. Refer to <a href="http://www.w3.org/TR/CSS21/visudet.html#line-height">section 10.8</a> of <a data-link-type="biblio" href="#biblio-css21">[CSS21]</a> for the normative CSS definition or the <a href="http://www.w3.org/TR/2002/WD-css3-linebox-20020515/">2002 Working Draft</a> 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.)</p>
<p class="issue" id="issue-95a9f423"><a class="self-link" href="#issue-95a9f423"></a> The CSSWG would like to know which baseline values are necessary: if any can be dropped, or any need to be added.</p>
<h3 class="heading settled" data-level="1.1" id="dominant-baseline property"><span class="secno">1.1. </span><span class="content"> Dominant Baselines: the <a class="property" data-link-type="propdesc" href="#propdef-dominant-baseline">dominant-baseline</a> property</span><a class="self-link" href="#dominant-baseline%20property"></a></h3>
<table class="definition propdef" data-link-for-hint="dominant-baseline">
<tbody>
<tr>
<th>Name:
<td><dfn class="css" data-dfn-type="property" data-export="" id="propdef-dominant-baseline">dominant-baseline<a class="self-link" href="#propdef-dominant-baseline"></a></dfn>
<tr class="value">
<th>Value:
<td class="prod">auto <a data-link-type="grammar" href="https://drafts.csswg.org/css-values-3/#comb-one">|</a> text-bottom <a data-link-type="grammar" href="https://drafts.csswg.org/css-values-3/#comb-one">|</a> alphabetic <a data-link-type="grammar" href="https://drafts.csswg.org/css-values-3/#comb-one">|</a> central <a data-link-type="grammar" href="https://drafts.csswg.org/css-values-3/#comb-one">|</a> mathematical <a data-link-type="grammar" href="https://drafts.csswg.org/css-values-3/#comb-one">|</a> hanging <a data-link-type="grammar" href="https://drafts.csswg.org/css-values-3/#comb-one">|</a> text-top
<tr>
<th>Initial:
<td>normal
<tr>
<th>Applies to:
<td>block containers and inline boxes
<tr>
<th>Inherited:
<td>yes
<tr>
<th>Percentages:
<td>N/A
<tr>
<th>Media:
<td>visual
<tr>
<th>Computed value:
<td>as specified
<tr>
<th>Animatable:
<td>no
</table>
<p>This property specifies the <dfn data-dfn-type="dfn" data-noexport="" id="dominant-baseline">dominant baseline<a class="self-link" href="#dominant-baseline"></a></dfn>,
which is the baseline used to align the box’s text and inline-level contents.
Values have the following meanings:</p>
<dl>
<dt><dfn class="css" data-dfn-for="dominant-baseline" data-dfn-type="value" data-export="" id="valdef-dominant-baseline-auto">auto<a class="self-link" href="#valdef-dominant-baseline-auto"></a></dfn>
<dd> Equivalent to <a class="css" data-link-type="maybe" href="#valdef-dominant-baseline-alphabetic">alphabetic</a> in <i>horizontal writing modes</i> and in <i>vertical writing modes</i> when <a class="property" data-link-type="propdesc" href="https://drafts.csswg.org/css-writing-modes-3/#propdef-text-orientation">text-orientation</a> is <a class="css" data-link-type="maybe" href="https://drafts.csswg.org/css-writing-modes-3/#valdef-text-orientation-sideways">sideways</a>, <a class="css" data-link-type="maybe" href="https://drafts.csswg.org/css-writing-modes-3/#valdef-text-orientation-sideways-right">sideways-right</a>, or <span class="css">sideways-left</span>.
equivalent to <a class="css" data-link-type="maybe" href="#valdef-dominant-baseline-central">central</a> in <i>vertical writing modes</i> when <a class="property" data-link-type="propdesc" href="https://drafts.csswg.org/css-writing-modes-3/#propdef-text-orientation">text-orientation</a> is <a class="css" data-link-type="maybe" href="https://drafts.csswg.org/css-writing-modes-3/#valdef-text-orientation-mixed">mixed</a> or <a class="css" data-link-type="maybe" href="https://drafts.csswg.org/css-writing-modes-3/#valdef-text-orientation-upright">upright</a>.
<dt><dfn class="css" data-dfn-for="dominant-baseline" data-dfn-type="value" data-export="" id="valdef-dominant-baseline-text-bottom">text-bottom<a class="self-link" href="#valdef-dominant-baseline-text-bottom"></a></dfn>
<dd> Use the bottom of the em box as the baseline.
<dt><dfn class="css" data-dfn-for="dominant-baseline" data-dfn-type="value" data-export="" id="valdef-dominant-baseline-alphabetic">alphabetic<a class="self-link" href="#valdef-dominant-baseline-alphabetic"></a></dfn>
<dd> Use the alphabetic baseline.
<dt><dfn class="css" data-dfn-for="dominant-baseline" 58E5 data-dfn-type="value" data-export="" id="valdef-dominant-baseline-central">central<a class="self-link" href="#valdef-dominant-baseline-central"></a></dfn>
<dd> Use the central baseline
(halfway between the ascent and descent).
<dt><dfn class="css" data-dfn-for="dominant-baseline" data-dfn-type="value" data-export="" id="valdef-dominant-baseline-mathematical">mathematical<a class="self-link" href="#valdef-dominant-baseline-mathematical"></a></dfn>
<dd> Use the mathematical baseline.
<dt><dfn class="css" data-dfn-for="dominant-baseline" data-dfn-type="value" data-export="" id="valdef-dominant-baseline-hanging">hanging<a class="self-link" href="#valdef-dominant-baseline-hanging"></a></dfn>
<dd> Use the hanging baseline.
<dt><dfn class="css" data-dfn-for="dominant-baseline" data-dfn-type="value" data-export="" id="valdef-dominant-baseline-text-top">text-top<a class="self-link" href="#valdef-dominant-baseline-text-top"></a></dfn>
<dd> Use the top of the em box as the baseline.
</dl>
<p>See <a data-link-type="biblio" href="#biblio-css3-writing-modes">[CSS3-WRITING-MODES]</a> for an introduction to dominant baselines.</p>
<p class="issue" id="issue-5c2889ea"><a class="self-link" href="#issue-5c2889ea"></a> 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 <a class="property" data-link-type="propdesc" href="#propdef-vertical-align">vertical-align</a>.</p>
<h3 class="heading settled" data-level="1.2" id="transverse-alignment"><span class="secno">1.2. </span><span class="content"> Transverse Box Alignment: the <a class="property" data-link-type="propdesc" href="#propdef-vertical-align">vertical-align</a> property</span><a class="self-link" href="#transverse-alignment"></a></h3>
<table class="definition propdef" data-link-for-hint="vertical-align">
<tbody>
<tr>
<th>Name:
<td><dfn class="css" data-dfn-type="property" data-export="" id="propdef-vertical-align">vertical-align<a class="self-link" href="#propdef-vertical-align"></a></dfn>
<tr class="value">
<th>Value:
<td class="prod"><a class="production" data-link-type="propdesc" href="#propdef-baseline-shift">&lt;‘baseline-shift’></a> <a data-link-type="grammar" href="https://drafts.csswg.org/css-values-3/#comb-any">||</a> <a class="production" data-link-type="propdesc" href="#propdef-alignment-baseline">&lt;‘alignment-baseline’></a>
<tr>
<th>Initial:
<td>baseline
<tr>
<th>Applies to:
<td>inline-level boxes
<tr>
<th>Inherited:
<td>no
<tr>
<th>Percentages:
<td>N/A
<tr>
<th>Media:
<td>visual
<tr>
<th>Computed value:
<td>as specified
<tr>
<th>Animatable:
<td>no
</table>
<p>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. </p>
<p class="advisement"> Authors should use this property (<a class="property" data-link-type="propdesc" href="#propdef-vertical-align">vertical-align</a>) instead of its longhands. </p>
<h4 class="heading settled" data-level="1.2.1" id="alignment-baseline-property"><span class="secno">1.2.1. </span><span class="content"> Alignment Point: <a class="property" data-link-type="propdesc" href="#propdef-alignment-baseline">alignment-baseline</a> longhand</span><a class="self-link" href="#alignment-baseline-property"></a></h4>
<table class="definition propdef" data-link-for-hint="alignment-baseline">
<tbody>
<tr>
<th>Name:
<td><dfn class="css" data-dfn-type="property" data-export="" id="propdef-alignment-baseline">alignment-baseline<a class="self-link" href="#propdef-alignment-baseline"></a></dfn>
<tr class="value">
<th>Value:
<td class="prod">baseline <a data-link-type="grammar" href="https://drafts.csswg.org/css-values-3/#comb-one">|</a> text-bottom <a data-link-type="grammar" href="https://drafts.csswg.org/css-values-3/#comb-one">|</a> alphabetic <a data-link-type="grammar" href="https://drafts.csswg.org/css-values-3/#comb-one">|</a> middle <a data-link-type="grammar" href="https://drafts.csswg.org/css-values-3/#comb-one">|</a> central <a data-link-type="grammar" href="https://drafts.csswg.org/css-values-3/#comb-one">|</a> mathematical <a data-link-type="grammar" href="https://drafts.csswg.org/css-values-3/#comb-one">|</a> text-top <a data-link-type="grammar" href="https://drafts.csswg.org/css-values-3/#comb-one">|</a> bottom <a data-link-type="grammar" href="https://drafts.csswg.org/css-values-3/#comb-one">|</a> center <a data-link-type="grammar" href="https://drafts.csswg.org/css-values-3/#comb-one">|</a> top
<tr>
<th>Initial:
<td>baseline
<tr>
<th>Applies to:
<td>inline-level boxes
<tr>
<th>Inherited:
<td>no
<tr>
<th>Percentages:
<td>N/A
<tr>
<th>Media:
<td>visual
8096 <tr>
<th>Computed value:
<td>as specified
<tr>
<th>Animatable:
<td>no
</table>
<p>Specifies what point of an inline-level box is aligned to what point in the parent.
Values are defined below: </p>
<p>For the following definitions, the margin box is used for atomic inlines,
and the leading box for non-replaced inlines:</p>
<dl>
<dt><dfn class="css" data-dfn-for="alignment-baseline" data-dfn-type="value" data-export="" id="valdef-alignment-baseline-baseline">baseline<a class="self-link" href="#valdef-alignment-baseline-baseline"></a></dfn>
<dd> Use the <i>dominant baseline</i> choice of the parent.
Match the box’s corresponding baseline to that of its parent.
<dt><dfn class="css" data-dfn-for="alignment-baseline" data-dfn-type="value" data-export="" id="valdef-alignment-baseline-text-bottom">text-bottom<a class="self-link" href="#valdef-alignment-baseline-text-bottom"></a></dfn>
<dd> Match the bottom of the box to the bottom of the parent’s content area.
<dt><dfn class="css" data-dfn-for="alignment-baseline" data-dfn-type="value" data-export="" id="valdef-alignment-baseline-alphabetic">alphabetic<a class="self-link" href="#valdef-alignment-baseline-alphabetic"></a></dfn>
<dd> Match the box’s alphabetic baseline to that of its parent.
<dt><dfn class="css" data-dfn-for="alignment-baseline" data-dfn-type="value" data-export="" id="valdef-alignment-baseline-middle">middle<a class="self-link" href="#valdef-alignment-baseline-middle"></a></dfn>
<dd> Align the vertical midpoint of the box with
the baseline of the parent box plus half the x-height of the parent.
<dt><dfn class="css" data-dfn-for="alignment-baseline" data-dfn-type="value" data-export="" id="valdef-alignment-baseline-central">central<a class="self-link" href="#valdef-alignment-baseline-central"></a></dfn>
<dd> Match the box’s central baseline to the central baseline of its parent.
<dt><dfn class="css" data-dfn-for="alignment-baseline" data-dfn-type="value" data-export="" id="valdef-alignment-baseline-mathematical">mathematical<a class="self-link" href="#valdef-alignment-baseline-mathematical"></a></dfn>
<dd> Match the box’s mathematical baseline to that of its parent.
<dt><dfn class="css" data-dfn-for="alignment-baseline" data-dfn-type="value" data-export="" id="valdef-alignment-baseline-text-top">text-top<a class="self-link" href="#valdef-alignment-baseline-text-top"></a></dfn>
<dd> Match the top of the box to the top of the parent’s content area.
</dl>
<p>For the following definitions, the <i>alignment subtree</i> is as defined in <a data-link-type="biblio" href="#biblio-css21">[CSS21]</a>.</p>
<dl>
<dt><dfn class="css" data-dfn-for="alignment-baseline" data-dfn-type="value" data-export="" id="valdef-alignment-baseline-top">top<a class="self-link" href="#valdef-alignment-baseline-top"></a></dfn>
<dd> Align the top of the aligned subtree with the top of the line box.
<dt><dfn class="css" data-dfn-for="alignment-baseline" data-dfn-type="value" data-export="" id="valdef-alignment-baseline-center">center<a class="self-link" href="#valdef-alignment-baseline-center"></a></dfn>
<dd> Align the center of the aligned subtree with the center of the line box.
<dt><dfn class="css" data-dfn-for="alignment-baseline" data-dfn-type="value" data-export="" id="valdef-alignment-baseline-bottom">bottom<a class="self-link" href="#valdef-alignment-baseline-bottom"></a></dfn>
<dd> Align the bottom of the aligned subtree with the bottom of the line box.
</dl>
<p class="issue" id="issue-b59edfd8"><a class="self-link" href="#issue-b59edfd8"></a> Putting <a class="css" data-link-type="maybe" href="#valdef-alignment-baseline-top">top</a>, <a class="css" data-link-type="maybe" href="#valdef-alignment-baseline-center">center</a>, and <a class="css" data-link-type="maybe" href="#valdef-alignment-baseline-bottom">bottom</a> in here is awkward,
because they’re not really baselines. :/</p>
<p>SVG implementations <em>may</em> support the following aliases
in order to support legacy content:</p>
<pre><dfn data-dfn-for="alignment-baseline" data-dfn-type="value" data-export="" id="valdef-alignment-baseline-text-before-edge">text-before-edge<a class="self-link" href="#valdef-alignment-baseline-text-before-edge"></a></dfn> = <a data-link-type="maybe" href="#valdef-alignment-baseline-text-top">text-top</a>
<dfn data-dfn-for="alignment-baseline" data-dfn-type="value" data-export="" id="valdef-alignment-baseline-text-after-edge">text-after-edge<a class="self-link" href="#valdef-alignment-baseline-text-after-edge"></a></dfn> = <a data-link-type="maybe" href="#valdef-alignment-baseline-text-bottom">text-bottom</a>
</pre>
<p>These values are not allowed in the <a class="property" data-link-type="propdesc" href="#propdef-vertical-align">vertical-align</a> shorthand.</p>
<h4 class="heading settled" data-level="1.2.2" id="baseline-shift-property"><span class="secno">1.2.2. </span><span class="content"> Alignment Shift: <a class="property" data-link-type="propdesc" href="#propdef-baseline-shift">baseline-shift</a> longhand</span><a class="self-link" href="#baseline-shift-property"></a></h4>
<table class="definition propdef" data-link-for-hint="baseline-shift">
<tbody>
<tr>
<th>Name:
<td><dfn class="css" data-dfn-type="property" data-export="" id="propdef-baseline-shift">baseline-shift<a class="self-link" href="#propdef-baseline-shift"></a></dfn>
<tr class="value">
<th>Value:
<td class="prod"><a class="production css" data-link-type="type" href="https://drafts.csswg.org/css-values-3/#length-value">&lt;length></a> <a data-link-type="grammar" href="https://drafts.csswg.org/css-values-3/#comb-one">|</a> <a class="production css" data-link-type="type" href="https://drafts.csswg.org/css-values-3/#percentage-value">&lt;percentage></a> <a data-link-type="grammar" href="https://drafts.csswg.org/css-values-3/#comb-one">|</a> sub <a data-link-type="grammar" href="https://drafts.csswg.org/css-values-3/#comb-one">|</a> super
<tr>
<th>Initial:
<td>0
<tr>
<th>Applies to:
<td>inline-level boxes
<tr>
<th>Inherited:
<td>no
<tr>
<th>Percentages:
<td>refer to the used value of <a class="property" data-link-type="propdesc" href="https://drafts.csswg.org/css2/visudet.html#propdef-line-height">line-height</a>
<tr>
<th>Media:
<td>visual
<tr>
<th>Computed value:
<td>absolute length, percentage, or keyword specified
<tr>
<th>Animatable:
<td>no
</table>
<p>This property specifies by how much the box is shifted up
from its alignment point.
It does not apply when <a class="property" data-link-type="propdesc" href="#propdef-alignment-baseline">alignment-baseline</a> is <a class="css" data-link-type="maybe" href="#valdef-alignment-baseline-top">top</a> or <a class="css" data-link-type="maybe" href="#valdef-alignment-baseline-bottom">bottom</a>. </p>
<p class="advisement"> Authors should use the <a class="property" data-link-type="propdesc" href="#propdef-vertical-align">vertical-align</a> shorthand instead of this property. </p>
<p>Values have the following meanings:</p>
<dl>
<dt><dfn class="css" data-dfn-for="baseline-shift" data-dfn-type="value" data-export="" id="valdef-baseline-shift-length"><a class="production css" data-link-type="type" href="https://drafts.csswg.org/css-values-3/#length-value">&lt;length></a><a class="self-link" href="#valdef-baseline-shift-length"></a></dfn>
<dd>Raise (positive value) or lower (negative value) by the specified length.
<dt><dfn class="css" data-dfn-for="baseline-shift" data-dfn-type="value" data-export="" id="valdef-baseline-shift-percentage"><a class="production css" data-link-type="type" href="https://drafts.csswg.org/css-values-3/#percentage-value">&lt;percentage></a><a class="self-link" href="#valdef-baseline-shift-percentage"></a></dfn>
<dd>Raise (positive value) or lower (negative value) by the specified percentage of the <a class="property" data-link-type="propdesc" href="https://drafts.csswg.org/css2/visudet.html#propdef-line-height">line-height</a>.
<dt><dfn class="css" data-dfn-for="baseline-shift" data-dfn-type="value" data-export="" id="valdef-baseline-shift-sub">sub<a class="self-link" href="#valdef-baseline-shift-sub"></a></dfn>
<dd>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.)
<dt><dfn class="css" data-dfn-for="baseline-shift" data-dfn-type="value" data-export="" id="valdef-baseline-shift-super">super<a class="self-link" href="#valdef-baseline-shift-super"></a></dfn>
<dd>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.)
</dl>
<p>User agents <em>may</em> additionally support the keyword <dfn data-dfn-for="baseline-shift" data-dfn-type="dfn" data-noexport="" id="baseline" type="value">baseline<a class="self-link" href="#baseline"></a></dfn> as computing to <span class="css">0</span> if is necessary for them to support legacy SVG content.
Issue: We would prefer to remove this, and are looking for feedback from SVG user agents as to whether it’s necessary. </p>
<h2 class="heading settled" data-level="2" id="initial-letter-styling"><span class="secno">2. </span><span class="content"> Initial Letters</span><a class="self-link" href="#initial-letter-styling"></a></h2>
<p class="issue" id="issue-f90429eb"><a class="self-link" href="#issue-f90429eb"></a>The editors would appreciate any examples of drop initials in non-western scripts, especially Arabic and Indic scripts.</p>
<h3 class="heading settled" data-level="2.1" id="initial-letter-intro"><span class="secno">2.1. </span><span class="content"> An Introduction to Initial Letters</span><a class="self-link" href="#initial-letter-intro"></a></h3>
<p>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.</p>
<h4 class="heading settled" data-level="2.1.1" id="drop-initial"><span class="secno">2.1.1. </span><span class="content"> Drop Initial</span><a class="self-link" href="#drop-initial"></a></h4>
<p>A <dfn data-dfn-type="dfn" data-noexport="" id="dropped-initial">dropped initial<a class="self-link" href="#dropped-initial"></a></dfn> (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.</p>
<figure>
<img alt="3-line drop cap with E Acute" src="images/Dropcap-E-acute-3line.png" width="480">
<p class="caption">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.</p>
</figure>
<p>The exact size and position of a <a data-link-type="dfn" href="#dropped-initial">dropped initial</a> depends on the alignment of its glyph. Reference points on the drop cap must align precisely with reference points in the text. 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. <a href="#f2">Figure 2</a> shows a simple two-line drop cap, with the relevant reference lines marked.</p>
<figure id="f2">
<img alt="drop cap showing alignment" src="images/Dropcap-lines.png" width="600">
<p class="caption">Two-line drop cap showing baselines (green lines), cap-height (red line), and ascender (cyan line).</p>
</figure>
<p>The alignment constraints for drop initials depend on the writing system. In ideographic scripts, the initial letter extends from the <a data-link-type="dfn" href="https://drafts.csswg.org/css-writing-modes-3/#block-start">block-start</a> edge of the first line to the <a data-link-type="dfn" href="https://drafts.csswg.org/css-writing-modes-3/#block-end">block-end</a> edge of the Nth line.</p>
<figure>
<img alt="Japanese Vertical Initial" src="images/Initial-2line-JapaneseVertical六.png" width="480">
<p class="caption">Two-line drop initial in vertical writing mode</p>
</figure>
<p>In some Indic scripts, the top alignment point
is the hanging baseline,
and the bottom alignment point is the text-after-edge.</p>
<figure>
<img alt="Devangari initial letter" src="images/Devangari-Initial.png" width="480">
<p class="caption">Devangari <a data-link-type="dfn" href="#initial-letter">initial letter</a> aligned with hanging baseline. Alignment points shown in red.</p>
</figure>
<h4 class="heading settled" data-level="2.1.2" id="sunk-initial"><span class="secno">2.1.2. </span><span class="content"> Sunken Initial Letters</span><a class="self-link" href="#sunk-initial"></a></h4>
<p>Some styles of drop initials do not align with the first line of text. A <dfn data-dfn-type="dfn" data-noexport="" id="sunken-initial">sunken initial<a class="self-link" href="#sunken-initial"></a></dfn> (or “sunken cap”) both sinks below the first baseline, and extends above the first line of text.</p>
<figure>
<img alt="sunken drop initial" src="images/SunkenCapA.png" width="480">
<p class="caption">Sunken cap. The letter drops two lines, but is the size of a three-line initial letter.</p>
</figure>
<h4 class="heading settled" data-level="2.1.3" id="raise-initial"><span class="secno">2.1.3. </span><span class="content"> Raised Initial Letters</span><a class="self-link" href="#raise-initial"></a></h4>
<p>A <dfn data-dfn-type="dfn" data-noexport="" id="raised-initial">raised initial<a class="self-link" href="#raised-initial"></a></dfn> (often called a “raised cap” or “stick-up cap”) “sinks” to the first text baseline. Unlike simply increasing the font size, which affects the line spacing below it to make room for potential descenders, it does not sink below that.</p>
<figure>
<img alt="raised cap" src="images/RaisedCap.png" width="480">
<p class="caption">Raised cap. The initial letter is the size of a 3-line initial, but does not drop.</p>
</figure>
<h3 class="heading settled" data-level="2.2" id="selecting-drop-initials"><span class="secno">2.2. </span><span class="content">Selecting Initial Letters</span><a class="self-link" href="#selecting-drop-initials"></a></h3>
<p>Initial letters are typically a single letter, which can be selected by the <code>::first-letter</code> pseudo-element, as defined in <a data-link-type="biblio" href="#biblio-select">[SELECT]</a>.</p>
<p>Authors who need more control over which characters are included in an initial letter, or who want to apply initial-letter formatting to replaced elements or multiple words can also apply the <a class="property" data-link-type="propdesc" href="#propdef-initial-letter">initial-letter</a> property to the first inline-level child of a block container. </p>
<div class="example" id="example-9394ec8b">
<a class="self-link" href="#example-9394ec8b"></a>
<pre>&lt;p>This paragraph has a dropped “T”.
&lt;p>&lt;img alt="H" src="illuminated-h.svg">ere we have an illuminated “H”.
&lt;p>&lt;span>Words may also&lt;/span> be given initial letter styling at the beginning of a paragraph.
</pre>
<pre>::first-letter, /* style first paragraph’s T */
img, /* style illuminated H */
span /* drop Words may also */
{ initial-letter: 2; }
</pre>
</div>
<h3 class="heading settled" data-level="2.3" id="sizing-drop-initials"><span class="secno">2.3. </span><span class="content"> Creating Initial Letters: the <a class="property" data-link-type="propdesc" href="#propdef-initial-letter">initial-letter</a> property</span><a class="self-link" href="#sizing-drop-initials"></a></h3>
<table class="definition propdef" data-link-for-hint="<dfn id=&quot;propdef-initial-letter&quot;>initial-letter</dfn>">
<tbody>
<tr>
<th>Name:
<td><dfn class="css" data-dfn-type="property" data-export="" id="propdef-initial-letter">initial-letter<a class="self-link" href="#propdef-initial-letter"></a></dfn>
<tr class="value">
<th>Value:
<td class="prod">normal <a data-link-type="grammar" href="https://drafts.csswg.org/css-values-3/#comb-one">|</a> [<a class="production css" data-link-type="type" href="https://drafts.csswg.org/css-values-3/#number-value">&lt;number></a> <a class="production css" data-link-type="type" href="https://drafts.csswg.org/css-values-3/#integer-value">&lt;integer></a><a data-link-type="grammar" href="https://drafts.csswg.org/css-values-3/#mult-opt">?</a>]
<tr>
<th>Initial:
<td>normal
<tr>
<th>Applies to:
<td><code>::first-letter</code> pseudo-elements and inline-level first child of a block container
<tr>
<th>Inherited:
<td>no
<tr>
<th>Percentages:
<td>N/A
<tr>
<th>Media:
<td>visual
<tr>
<th>Computed value:
<td>as specified
<tr>
<th>Animatable:
<td>no
</table>
<p>This property specifies styling for dropped, raised, and sunken initial letters. It takes the following values:</p>
<dl>
<dt><dfn class="css" data-dfn-for="initial-letter" data-dfn-type="value" data-export="" id="valdef-initial-letter-normal">normal<a class="self-link" href="#valdef-initial-letter-normal"></a></dfn>
<dd>No special initial-letter effect. Text behaves as normal.
<dt><dfn class="css" data-dfn-for="initial-letter" data-dfn-type="value" data-export="" id="valdef-initial-letter-number"><a class="production css" data-link-type="type" href="https://drafts.csswg.org/css-values-3/#number-value">&lt;number></a><a class="self-link" href="#valdef-initial-letter-number"></a></dfn>
<dd>This first argument defines the size of the initial letter, in terms of how many lines it occupies. Negative values are not allowed.
<dt><dfn class="css" data-dfn-for="initial-letter" data-dfn-type="value" data-export="" id="valdef-initial-letter-integer"><a class="production css" data-link-type="type" href="https://drafts.csswg.org/css-values-3/#integer-value">&lt;integer></a><a class="self-link" href="#valdef-initial-letter-integer"></a></dfn>
<dd>This optional second argument argument defines the number of lines the initial letter should sink. Values must be greater than zero. If omitted, it duplicates the first argument, floored to the nearest positive whole number.
</dl>
<p class="issue" id="issue-4601aace"><a class="self-link" href="#issue-4601aace"></a> Should this be <span class="css">initial-letters</span> (plural) as originally discussed?
Since it can apply to multiple letters.</p>
<p>An <dfn data-dfn-type="dfn" data-lt="initial letter | initial letter box" data-noexport="" id="initial-letter">initial letter<a class="self-link" href="#initial-letter"></a></dfn> is
a box to which <a class="property" data-link-type="propdesc" href="#propdef-initial-letter">initial-letter</a> applies and is not <a class="css" data-link-type="maybe" href="#valdef-initial-letter-normal">normal</a>:
this triggers the special layout considerations described below.</p>
<div class="example" id="example-f3165b99">
<a class="self-link" href="#example-f3165b99"></a> Here are some examples of <a class="property" data-link-type="propdesc" href="#propdef-initial-letter">initial-letter</a> usage:
<dl>
<dt><a class="css" data-link-type="propdesc" href="#propdef-initial-letter">initial-letter: 3</a>
<dt>(<a class="css" data-link-type="propdesc" href="#propdef-initial-letter">initial-letter: 3 3</a>)
<dd>
Represents a <a data-link-type="dfn" href="#dropped-initial">dropped initial</a> 3 lines high, 3 lines deep.
<p><img alt="3 lines high, 3 lines deep" src="images/InitialLetter33.png" width="360"></p>
<dt><a class="css" data-link-type="propdesc" href="#propdef-initial-letter">initial-letter: 3 2</a>
<dd>
Represents a <a data-link-type="dfn" href="#sunken-initial">sunken initial</a> 3 lines high, 2 lines deep.
<p><img alt="3 lines high, 2 lines deep" src="images/InitialLetter32.png" width="360"></p>
<dt><a class="css" data-link-type="propdesc" href="#propdef-initial-letter">initial-letter: 3 1</a>
<dd>
Represents a <a data-link-type="dfn" href="#raised-initial">raised initial</a> 3 lines high, 1 line deep.
<p><img alt="3 lines high, 1 line deep" src="images/InitialLetter31.png" width="360"></p>
</dl>
</div>
<div class="example" id="example-3c97a721">
<a class="self-link" href="#example-3c97a721"></a> The following code will create a 2-line dropped initial letter at the beginning of each paragraph:
<pre>p::first-letter { initial-letter: 2; }</pre>
</div>
<p class="issue" id="issue-664624cd"><a class="self-link" href="#issue-664624cd"></a> Define interaction with Ruby. Easiest is to make it not apply to/within ruby.</p>
<p>The <a class="property" data-link-type="propdesc" href="#propdef-initial-letter">initial-letter</a> property does not apply to boxes that are not positioned at the start of the line due to bidi reordering.</p>
<h4 class="heading settled" data-level="2.3.1" id="initial-letter-properties"><span class="secno">2.3.1. </span><span class="content"> Properties</span><a class="self-link" href="#initial-letter-properties"></a></h4>
<p>The following properties apply to an <a data-link-type="dfn" href="#initial-letter">initial letter</a>:</p>
<ul>
<li>all font properties (see <a data-link-type="biblio" href="#biblio-css3-fonts">[CSS3-FONTS]</a>)
<li>the <a class="property" data-link-type="propdesc" href="https://drafts.csswg.org/css-color-3/#color0">color</a> and <a class="property" data-link-type="propdesc" href="https://drafts.csswg.org/css-color-4/#propdef-opacity">opacity</a> properties (see <a data-link-type="biblio" href="#biblio-css3color">[CSS3COLOR]</a>)
<li>all background properties (see <a data-link-type="biblio" href="#biblio-css3bg">[CSS3BG]</a>)
<li>any typesetting properties that apply to inline elements (see <a data-link-type="biblio" href="#biblio-css3text">[CSS3TEXT]</a>)
<li>all text decoration properties (see <a data-link-type="biblio" href="#biblio-css3-text-decor">[CSS3-TEXT-DECOR]</a>)
<li>all margin, border and padding properties (see <a data-link-type="biblio" href="#biblio-css21">[CSS21]</a> and <a data-link-type="biblio" href="#biblio-css3bg">[CSS3BG]</a>)
</ul>
<p class="issue" id="issue-939d845d"><a class="self-link" href="#issue-939d845d"></a> Add <a class="property" data-link-type="propdesc" href="https://drafts.csswg.org/css2/visudet.html#propdef-width">width</a>/<a class="property" data-link-type="propdesc" href="https://drafts.csswg.org/css2/visudet.html#propdef-height">height</a> as requested by Tantek... need to integrate with model.</p>
<h4 class="heading settled" data-level="2.3.2" id="initial-letter-model"><span class="secno">2.3.2. </span><span class="content"> Layout Model</span><a class="self-link" href="#initial-letter-model"></a></h4>
<p>An <a data-link-type="dfn" href="#initial-letter">initial letter</a> is laid out following the steps outlined below:</p>
<ol>
<li>Find the used font size based on its <a class="property" data-link-type="propdesc" href="#propdef-initial-letter">initial-letter</a> size, <a class="property" data-link-type="propdesc" href="#propdef-initial-letter-align">initial-letter-align</a> alignment points, and font metrics.
Note that no layout is required in this step.
The font size used for sizing the <a data-link-type="dfn" href="#initial-letter">initial letter</a> contents <em>does not</em> affect its computed <a class="property" data-link-type="propdesc" href="https://drafts.csswg.org/css-fonts-3/#propdef-font-size">font-size</a> property
(and therefore has no effect on the computation of <span class="css">em</span> length values, etc.).
<li>Size the <a data-link-type="dfn" href="#initial-letter">initial letter</a>’s content box.
The content box of a non-atomic inline initial letter
is the smallest rectangle required to include the entirety of its glyphs
as well as the margin boxes of any atomic inlines it contains.
<li>The initial letter’s margin box is placed at the edge of the line.
If it has no padding or 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 had <a class="css" data-link-type="propdesc" href="#propdef-initial-letter">initial-letter: none</a>.
<li>Exclude content within the inline letter’s margin box
according to <a class="property" data-link-type="propdesc" href="#propdef-initial-letter-wrap">initial-letter-wrap</a>.
</ol>
<h4 class="heading settled" data-level="2.3.3" id="initial-letter-box"><span class="secno">2.3.3. </span><span class="content"> Content-box Size, Margins, Borders, and Padding</span><a class="self-link" href="#initial-letter-box"></a></h4>
<p>Initial letters can be styled with margins, padding, and borders just like any other box.
Unless <a class="property" data-link-type="propdesc" href="#propdef-initial-letter-align">initial-letter-align</a> is <a class="css" data-link-type="maybe" href="#valdef-initial-letter-align-border-box">border-box</a>,
its vertical alignment and sizing are not affected;
however the effective exclusion area is (and corresponds to the margin area).</p>
<p>When padding and borders are zero, the initial letter may be kerned; see below.</p>
<h3 class="heading settled" data-level="2.4" id="aligning-initial-letter"><span class="secno">2.4. </span><span class="content"> Alignment of Initial Letters: the <a class="property" data-link-type="propdesc" href="#propdef-initial-letter-align">initial-letter-align</a> property</span><a class="self-link" href="#aligning-initial-letter"></a></h3>
<p>As mentioned earlier, the alignment of initial letters depends on the script used. The <a class="property" data-link-type="propdesc" href="#propdef-initial-letter-align">initial-letter-align</a> property can be used to specify the proper alignment.</p>
<table class="definition propdef" data-link-for-hint="<dfn id=&quot;propdef-initial-letter-align&quot;>initial-letter-align</dfn>">
<tbody>
<tr>
<th>Name:
<td><dfn class="css" data-dfn-type="property" data-export="" id="propdef-initial-letter-align">initial-letter-align<a class="self-link" href="#propdef-initial-letter-align"></a></dfn>
<tr class="value">
<th>Value:
<td class="prod">border-box<a data-link-type="grammar" href="https://drafts.csswg.org/css-values-3/#mult-opt">?</a> [ alphabetic <a data-link-type="grammar" href="https://drafts.csswg.org/css-values-3/#comb-one">|</a> ideographic <a data-link-type="grammar" href="https://drafts.csswg.org/css-values-3/#comb-one">|</a> hebrew <a data-link-type="grammar" href="https://drafts.csswg.org/css-values-3/#comb-one">|</a> hanging ] <a data-link-type="grammar" href="https://drafts.csswg.org/css-values-3/#comb-one">|</a> border-box
<tr>
<th>Initial:
<td>alphabetic
<tr>
<th>Applies to:
<td><code>::first-letter</code> pseudo elements and inline level first child of a block container
<tr>
<th>Inherited:
<td>yes
<tr>
<th>Percentages:
<td>N/A
<tr>
<th>Media:
<td>visual
<tr>
<th>Computed value:
<td>specified value
<tr>
<th>Animatable:
<td>no
</table>
<p>This property specifies the alignment points used to size and position an <a data-link-type="dfn" href="#initial-letter">initial letter</a>.
Two sets of alignment points are necessary:
the <a data-link-type="dfn" href="https://drafts.csswg.org/css-writing-modes-3/#over">over</a> and <a data-link-type="dfn" href="https://drafts.csswg.org/css-writing-modes-3/#under">under</a> alignment points of the <a data-link-type="dfn" href="#initial-letter">initial letter</a> are matched to corresponding <a data-link-type="dfn" href="https://drafts.csswg.org/css-writing-modes-3/#over">over</a> and <a data-link-type="dfn" href="https://drafts.csswg.org/css-writing-modes-3/#under">under</a> points of the surrounding text.</p>
<p>Values have the following meanings:</p>
<dl>
<dt><dfn class="css" data-dfn-for="initial-letter-align" data-dfn-type="value" data-export="" id="valdef-initial-letter-align-alphabetic">alphabetic<a class="self-link" href="#valdef-initial-letter-align-alphabetic"></a></dfn>
<dd>Use the alphabetic and cap-height baselines of the surrounding text
to align the <a data-link-type="dfn" href="#initial-letter">initial letter</a>.
<dt><dfn class="css" data-dfn-for="initial-letter-align" data-dfn-type="value" data-export="" id="valdef-initial-letter-align-ideographic">ideographic<a class="self-link" href="#valdef-initial-letter-align-ideographic"></a></dfn>
<dd>Use the ideographic character face bottom and top edge baselines of the surrounding text
to align the <a data-link-type="dfn" href="#initial-letter">initial letter</a>.
<dt><dfn class="css" data-dfn-for="initial-letter-align" data-dfn-type="value" data-export="" id="valdef-initial-letter-align-hebrew">hebrew<a class="self-link" href="#valdef-initial-letter-align-hebrew"></a></dfn>
<dd>Use the alphabetic and (as yet theoretical) hebrew hanging baseline of the surrounding text
to align the <a data-link-type="dfn" href="#initial-letter">initial letter</a>.
<dt><dfn class="css" data-dfn-for="initial-letter-align" data-dfn-type="value" data-export="" id="valdef-initial-letter-align-hanging">hanging<a class="self-link" href="#valdef-initial-letter-align-hanging"></a></dfn>
<dd>Use the alphabetic and hanging baselines of the surrounding text
to align the <a data-link-type="dfn" href="#initial-letter">initial letter</a>.
<dt><dfn class="css" data-dfn-for="initial-letter-align" data-dfn-type="value" data-export="" id="valdef-initial-letter-align-border-box">border-box<a class="self-link" href="#valdef-initial-letter-align-border-box"></a></dfn>
<dd>Uses the <a data-link-type="dfn" href="#initial-letter">initial letter box</a>’s <a data-link-type="dfn" href="https://drafts.csswg.org/css-writing-modes-3/#line-over">line-over</a> and <a data-link-type="dfn" href="https://drafts.csswg.org/css-writing-modes-3/#line-under">line-under</a> border edges
as the <a data-link-type="dfn" href="https://drafts.csswg.org/css-writing-modes-3/#over">over</a> and <a data-link-type="dfn" href="https://drafts.csswg.org/css-writing-modes-3/#under">under</a> alignment points, respectively.
</dl>
<div class="example" id="example-0cc7f40b">
<a class="self-link" href="#example-0cc7f40b"></a> The vertical writing mode example from <a href="#f2">Figure 2</a> could be coded as:
<pre>span.initial {
initial-letter: 2;
initial-letter-alignment: ideographic;
}
</pre>
</div>
<p>Except when <a class="css" data-link-type="maybe" href="#valdef-initial-letter-align-border-box">border-box</a> is specified,
the alignment points of the <a data-link-type="dfn" href="#initial-letter">initial letter</a> are automatically determined from its contents:</p>
<ol>
<li>If the <a data-link-type="dfn" href="#initial-letter">initial letter</a> is an atomic inline,
use its <a data-link-type="dfn" href="https://drafts.csswg.org/css-writing-modes-3/#over">over</a> and <a data-link-type="dfn" href="https://drafts.csswg.org/css-writing-modes-3/#under">under</a> content-box edges.
<li>Else if the <a data-link-type="dfn" href="#initial-letter">initial letter</a> contains any character from the Han, Hangul, Kana, or Yi <a data-link-type="dfn" href="https://drafts.csswg.org/css-text-3/#unicode- 4E49 script">Unicode scripts</a>,
use the ideographic character face bottom and top edge baselines.
<li>Else if the <a data-link-type="dfn" href="#initial-letter">initial letter</a> contains any character from the Hebrew <a data-link-type="dfn" href="https://drafts.csswg.org/css-text-3/#unicode-script">Unicode scripts</a>,
use the ideographic character face bottom and top edge baselines.
<li>Else use the alphabetic and cap-height baselines.
</ol>
<p class="note" role="note">Note: The ordering of keywords in this property is fixed in case <a class="css" data-link-type="maybe" href="#valdef-initial-letter-align-border-box">border-box</a> is expanded to <span class="css">[ border-box | alphabetic | ideographic | hebrew | hanging ]</span> to allow explicitly specifying the <a data-link-type="dfn" href="#initial-letter">initial letter</a>’s alignment points.</p>
<h4 class="heading settled" data-level="2.4.1" id="initial-letter-align-defaults"><span class="secno">2.4.1. </span><span class="content"> UA Default Stylesheet for <a class="property" data-link-type="propdesc" href="#propdef-initial-letter-align">initial-letter-align</a></span><a class="self-link" href="#initial-letter-align-defaults"></a></h4>
<p>In order to provide the better behavior by default,
UAs must include in their default UA style sheet the following rules:</p>
<pre>[lang=zh], [lang=ja], [lang=ko], [lang=ii] {
initial-letter-align: ideographic;
}
[lang|=iw], [lang|=yi], [lang|=lad], [lang|=jrb] {
initial-letter-align: hebrew;
}
[lang|=hi], [lang|=mr], [lang|=ne], , [lang|=pi], [lang|=kok], [lang|=brx], [lang|=mai], [lang|=sd], [lang|=sa] {
initial-letter-align: hanging;
}
</pre>
<p class="issue" id="issue-4c0f245b"><a class="self-link" href="#issue-4c0f245b"></a> We don’t have a way to do subtag selection with attr selectors.
(It’s a feature of <a class="css" data-link-type="maybe" href="https://drafts.csswg.org/selectors-4/#lang-pseudo">:lang()</a> in Selectors 4,
but we don’t want to use that because we want to hit the language root,
not all of the descendant elements.)
These selectors should also include the relevant script subtags.</p>
<h3 class="heading settled" data-level="2.5" id="sizing-initial-letters"><span class="secno">2.5. </span><span class="content"> Sizing Initial Letters</span><a class="self-link" href="#sizing-initial-letters"></a></h3>
<p>The size of a drop initial is determined by the need to satisfy the required alignment. 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 <b>not</b> the font size of the drop initial.</p>
<p>Actually calculating this font size is tricky. For an N-line drop initial, we find the drop initial font size to be:</p>
<figure> <img alt="Equation to calcuate drop initial font size" src="images/InitialCapEquation.png" width="604"> </figure>
<p></p>
<p></p>
<div class="example" id="example-d15548da"><a class="self-link" href="#example-d15548da"></a> 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). </div>
<p>The line height used in this calculation is the <a class="property" data-link-type="propdesc" href="https://drafts.csswg.org/css2/visudet.html#propdef-line-height">line-height</a> 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 <a data-link-type="biblio" href="#biblio-css3-line-grid">[CSS3-LINE-GRID]</a>). The contents of the lines spanned, and therefore any variation in their heights and positions, is not accounted for.</p>
<h4 class="heading settled" data-level="2.5.1" id="initial-letter-shaping"><span class="secno">2.5.1. </span><span class="content"> Shaping and Glyph Selection</span><a class="self-link" href="#initial-letter-shaping"></a></h4>
<p>When <a class="property" data-link-type="propdesc" href="#propdef-initial-letter">initial-letter</a> is not <a class="css" data-link-type="maybe" href="#valdef-initial-letter-normal">normal</a>, shaping does not occur across the box’s boundaries,
as if the zero-width non-joiner (U+200C) were inserted before/after the <a data-link-type="dfn" href="#initial-letter">initial letter</a>.
For example, if the first letter of the Farsi word “پس” were styled with <a class="css" data-link-type="propdesc" href="#propdef-initial-letter">initial-letter: 2 1</a>,
both letters would be styled in their isolated forms,
with “پ” as the initial letter, followed by the normally-styled “س”.</p>
<p class="issue" id="issue-bef56215"><a class="self-link" href="#issue-bef56215"></a> Are there other things we need to consider here?</p>
<h3 class="heading settled" data-level="2.6" id="initial-letter-exclusions"><span class="secno">2.6. </span><span class="content"> Space Around Initial Letters</span><a class="self-link" href="#initial-letter-exclusions"></a></h3>
<p>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.</p>
<figure>
<img alt="3-line drop cap with J, with descender crashing into fourth line of text" src="images/Dropcap-J-3line-crash.png" width="480">
<p class="caption">Incorrect: three-line initial letter with descender</p>
</figure>
<p>Text is therefore excluded around the glyph bounding boxes of the initial letters.</p>
<p>Specifically, for non-atomic initial letters, the content box of the element is sized to fit:</p>
<ul>
<li>The specified amount of sink (i.e the distance from the top alignment point to the bottom alignment point).
<li>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.
<li>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.
</ul>
<p>The margin box of the initial letter is then made an exclusion area for subsequent text.</p>
<figure>
<img alt="3-line drop cap with J, but four-line exclusion" src="images/Dropcap-J-3line-exclude.png" width="480">
<p class="caption">Correct: text excluded around glyph bounding box</p>
</figure>
<h3 class="heading settled" data-level="2.7" id="initial-letter-position"><span class="secno">2.7. </span><span class="content"> Positioning and Kerning Initial Letters</span><a class="self-link" href="#initial-letter-position"></a></h3>
<p>In the <a data-link-type="dfn" href="https://drafts.csswg.org/css-writing-modes-3/#block-axis">block axis</a>, the <a data-link-type="dfn" href="#initial-letter">initial letter</a> is positioned to satisfy its alignment requirements. (See <a class="property" data-link-type="propdesc" href="#propdef-initial-letter-align">initial-letter-align</a>.)</p>
<p>In the <a data-link-type="dfn" href="https://drafts.csswg.org/css-writing-modes-3/#inline-axis">inline axis</a>, the position of the inline letter is given by aligning its start margin edge to the start edge of the containing block.</p>
<p>However, if the <a data-link-type="dfn" href="#initial-letter">initial letter</a> is a non-atomic inline with zero padding and borders, the UA must apply an additional negative offset on the start side of the amount necessary to optically align the first glyph to the containing block edge as it would be in normal text.</p>
<h3 class="heading settled" data-level="2.8" id="initial-letter-wrapping"><span class="secno">2.8. </span><span class="content"> Initial Letter Wrapping: the <a class="property" data-link-type="propdesc" href="#propdef-initial-letter-wrap">initial-letter-wrap</a> property</span><a class="self-link" href="#initial-letter-wrapping"></a></h3>
<p class="note" role="note">Note: <a class="property" data-link-type="propdesc" href="#propdef-initial-letter-wrap">initial-letter-wrap</a> is at risk.</p>
<table class="definition propdef" data-link-for-hint="<dfn id=&quot;propdef-initial-letter-wrap&quot;>initial-letter-wrap</dfn>">
<tbody>
<tr>
<th>Name:
<td><dfn class="css" data-dfn-type="property" data-export="" id="propdef-initial-letter-wrap">initial-letter-wrap<a class="self-link" href="#propdef-initial-letter-wrap"></a></dfn>
<tr class="value">
<th>Value:
<td class="prod">none <a data-link-type="grammar" href="https://drafts.csswg.org/css-values-3/#comb-one">|</a> first <a data-link-type="grammar" href="https://drafts.csswg.org/css-values-3/#comb-one">|</a> all <a data-link-type="grammar" href="https://drafts.csswg.org/css-values-3/#comb-one">|</a> grid <a data-link-type="grammar" href="https://drafts.csswg.org/css-values-3/#comb-one">|</a> <a class="production css" data-link-type="type" href="https://drafts.csswg.org/css-values-3/#length-value">&lt;length></a> <a data-link-type="grammar" href="https://drafts.csswg.org/css-values-3/#comb-one">|</a> <a class="production css" data-link-type="type" href="https://drafts.csswg.org/css-values-3/#percentage-value">&lt;percentage></a>
<tr>
<th>Initial:
<td>none
<tr>
<th>Applies to:
<td><code>::first-letter</code> pseudo-elements and inline-level first child of a block container
<tr>
<th>Inherited:
<td>yes
<tr>
<th>Percentages:
<td>relative to <a data-link-type="dfn" href="https://drafts.csswg.org/css-writing-modes-3/#logical-width">logical width</a> of (last fragment of) initial letter
<tr>
<th>Media:
<td>visual
<tr>
<th>Computed value:
<td>as specified
<tr>
<th>Animatable:
<td>no
</table>
<p>This property specifies whether lines impacted by an <a data-link-type="dfn" href="#initial-letter">initial letter</a> are shortened to fit the rectangular shape of the <a data-link-type="dfn" href="#initial-letter">initial letter</a> box
or follow the contour of its end-edge glyph outline.</p>
<dl>
<dt><dfn class="css" data-dfn-for="initial-letter-wrap" data-dfn-type="value" data-export="" id="valdef-initial-letter-wrap-none">none<a class="self-link" href="#valdef-initial-letter-wrap-none"></a></dfn>
<dd>No contour-fitting is performed:
each impacted line is aligned flush to the end margin edge of the <a data-link-type="dfn" href="#initial-letter">initial letter</a>.
<dt><dfn class="css" data-dfn-for="initial-letter-wrap" data-dfn-type="value" data-export="" id="valdef-initial-letter-wrap-first">first<a class="self-link" href="#valdef-initial-letter-wrap-first"></a></dfn>
<dd>
Behaves as <a class="css" data-link-type="maybe" href="#valdef-initial-letter-wrap-none">none</a> if
the first <a data-link-type="dfn" href="https://drafts.csswg.org/css-text-3/#typographic-character-unit">typographic character unit</a> after the <a data-link-type="dfn" href="#initial-letter">initial letter</a> belongs to Unicode General Category Zs.
Otherwise behaves as for <a class="css" data-link-type="maybe" href="#valdef-initial-letter-wrap-all">all</a> on the first line of the block containing the initial letter
and as <a class="css" data-link-type="maybe" href="#valdef-initial-letter-wrap-none">none</a> on the rest.
<div class="example" id="example-cdb7c78e">
<a class="self-link" href="#example-cdb7c78e"></a> This example shows why the contour-fitting the first line is necessary,
and why it is dropped when the <a data-link-type="dfn" href="#initial-letter">initial letter</a> is followed by a space:
<figure>
<img alt="optical kerning in the presence or absence of a space after the initial letter" src="images/OpticalKerning.png" width="200">
<p class="caption"> 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. </p>
</figure>
</div>
<p class="issue" id="issue-a826765c"><a class="self-link" href="#issue-a826765c"></a> Do we need an unconditional <a class="css" data-link-type="maybe" href="#valdef-initial-letter-wrap-first">first</a>?
(I.e. Should we rename this value to <a class="css" data-link-type="maybe" href="#valdef-dominant-baseline-auto">auto</a> and add a <a class="css" data-link-type="maybe" href="#valdef-initial-letter-wrap-first">first</a> value that does not check for spaces?)</p>
<dt><dfn class="css" data-dfn-for="initial-letter-wrap" data-dfn-type="value" data-export="" id="valdef-initial-letter-wrap-all">all<a class="self-link" href="#valdef-initial-letter-wrap-all"></a></dfn>
<dd>For each line of text impacted by the initial letter, the line box adjacent to the intial letter starts at the start-most point that touches the ink of the initial letter, plus the amount of the <a data-link-type="dfn" href="#initial-letter">initial letter</a>’s end-side border+padding+margin.
<p class="note" role="note">Note: This value is at-risk.</p>
<dt><dfn class="css" data-dfn-for="initial-letter-wrap" data-dfn-type="value" data-export="" id="valdef-initial-letter-wrap-grid">grid<a class="self-link" href="#valdef-initial-letter-wrap-grid"></a></dfn>
<dd>
This value is the same as <a class="css" data-link-type="maybe" href="#valdef-initial-letter-wrap-none">none</a>,
except that the exclusion area of the impacted lines
is increased as necessary for its end-edge to land on the character grid.
The <a class="property" data-link-type="propdesc" href="https://drafts.csswg.org/css-align-3/#propdef-justify-self">justify-self</a> property can then be used to align the initial letter box
within the exclusion area.
<p>The heuristic for matching the character grid is
1em × <var>n</var> + <a class="property" data-link-type="propdesc" href="https://drafts.csswg.org/css-text-3/#propdef-letter-spacing">letter-spacing</a> × (<var>n</var> - 1),
where <var>n</var> is the size of the initial letter
as specified by the <a class="property" data-link-type="propdesc" href="#propdef-initial-letter">initial-letter</a> property,
and 1em represents the typical character advance width for ideographic characters
(and may be replaced by a more accurate value if known).</p>
<figure>
<img alt="Diagram of Japanese initial letter in vertical writing mode" src="images/CJK-Initial.001.png" width="480">
<p class="caption">Diagram of Japanese initial letter in vertical writing mode</p>
</figure>
<p class="note" role="note">Note: In this example, the exclusion area for the drop initial
is larger than its glyph in order to preserve inline-axis alignment.</p>
<p class="note" role="note">Note: This value is also at-risk.</p>
<dt><dfn class="css" data-dfn-for="initial-letter-wrap" data-dfn-type="value" data-export="" id="valdef-initial-letter-wrap-length"><a class="production css" data-link-type="type" href="https://drafts.csswg.org/css-values-3/#length-value">&lt;length></a><a class="self-link" href="#valdef-initial-letter-wrap-length"></a></dfn>
<dt><dfn class="css" data-dfn-for="initial-letter-wrap" data-dfn-type="value" data-export="" id="valdef-initial-letter-wrap-percentage"><a class="production css" data-link-type="type" href="https://drafts.csswg.org/css-values-3/#percentage-value">&lt;percentage></a><a class="self-link" href="#valdef-initial-letter-wrap-percentage"></a></dfn>
<dd>
This value behaves the same as <a class="css" data-link-type="maybe" href="#valdef-initial-letter-wrap-first">first</a> except that the adjustment to the first line is given explicitly
instead of being inferred from the glyph shape.
<p class="issue" id="issue-645378a9"><a class="self-link" href="#issue-645378a9"></a> This really needs font-relative lengths to be relative to the used size.</p>
<p class="note" role="note">Note: This value exists because it is easier to implement.
Authors are encouraged to use the <a class="css" data-link-type="maybe" href="#valdef-initial-letter-wrap-first">first</a> value
and to set margins to control spacing,
and to use this as a fallback for glyph detection if necessary.</p>
<div class="example" id="example-e11c0dc6">
<a class="self-link" href="#example-e11c0dc6"></a> In the following example, UAs that support <a class="css" data-link-type="maybe" href="#valdef-initial-letter-wrap-first">first</a> will use the glyph outline
plus the specified margin in order to place the first line,
whereas UAs that only support <a class="production css" data-link-type="type" href="https://drafts.csswg.org/css-values-3/#length-value">&lt;length></a> or <a class="production css" data-link-type="type" href="https://drafts.csswg.org/css-values-3/#percentage-value">&lt;percentage></a> values
will pull in the first line by 40% of the initial letter’s width
(and then add the margin to that point).
<pre>h1 + p:first-letter {
initial-letter: 3; /* 3-line drop-cap */
initial-letter-wrap: first;
margin-right: 0.1em;
}
@supports (not (initial-letter-wrap: first)) {
/* Classes auto-generated on paragraphs to match first letter. */
p.A:first-letter {
initial-letter-wrap: -40%; /* Start of glyph outline, assuming correct font. */
}
}
</pre>
</div>
<p class="issue" id="issue-76db6c38"><a class="self-link" href="#issue-76db6c38"></a> These values and related annoyance is likely unnecessary if someone submits a patch to Blink to support <a class="css" data-link-type="maybe" href="#valdef-initial-letter-wrap-first">first</a>.</p>
</dl>
<p class="issue" id="issue-c4ff3304"><a class="self-link" href="#issue-c4ff3304"></a> Edit figure to show how auto behaves in varying contexts</p>
<div class="example" id="example-768e3a03">
<a class="self-link" href="#example-768e3a03"></a>
<pre>p::first-letter {
initial-letter: 3;
initial-letter-wrap: none;
}
</pre>
<p><img alt="regular dropcap A" src="images/A-wraparound-none.png" width="600"></p>
<p>Ordinary initial letter with no wrapping.</p>
</div>
<div class="example" id="example-dce39d6a">
<a class="self-link" href="#example-dce39d6a"></a>
<pre>p::first-letter {
initial-letter: 3;
initial-letter-wrap: auto;
}
</pre>
<p><img alt="text wrapping around dropcap A" src="images/A-wraparound.png" width="600"></p>
<p>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>
</div>
<div class="example" id="example-5f1034eb">
<a class="self-link" href="#example-5f1034eb"></a>
<pre>p::first-letter {
initial-letter: 3;
initial-letter-wrap: first;
}
</pre>
<p><img alt="text wrapping around dropcap A but only on first line" src="images/A-wraparound-first.png" width="600"></p>
<p>Only the first line is moved up against the ink of the initial letter.</p>
</div>
<div class="example" id="example-6bc85a3f">
<a class="self-link" href="#example-6bc85a3f"></a>
<p><img alt="text wrapping around dropcap V" src="images/V-wraparound.png" width="600"></p>
</div>
<div class="example" id="example-9b96d6e5">
<a class="self-link" href="#example-9b96d6e5"></a>
<p><img alt="text wrapping around dropcap P" src="images/P-wraparound.png" width="600"></p>
</div>
<div class="example" id="example-9d9f2b4a">
<a class="self-link" href="#example-9d9f2b4a"></a>
<p><img alt="text wrapping around dropcap W" src="images/W-wraparound.png" width="600"></p>
</div>
<h3 class="heading settled" data-level="2.9" id="initial-letter-indentation"><span class="secno">2.9. </span><span class="content"> Indentation and Multi-line Effects</span><a class="self-link" href="#initial-letter-indentation"></a></h3>
<p><a class="property" data-link-type="propdesc" href="https://drafts.csswg.org/css-text-3/#propdef-text-indent">text-indent</a> and <a class="property" data-link-type="propdesc" href="https://drafts.csswg.org/css-text-3/#propdef-hanging-punctuation">hanging-punctuation</a> 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.</p>
<p>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.</p>
<figure>
<img alt="multi-line drop cap" src="images/Multi-line-initial.png" width="300">
<p class="caption">Drop cap extends to two lines.</p>
</figure>
<h3 class="heading settled" data-level="2.10" id="initial-letter-paragraphs"><span class="secno">2.10. </span><span class="content"> Clearing Initial Letters</span><a class="self-link" href="#initial-letter-paragraphs"></a></h3>
<h4 class="heading settled" data-level="2.10.1" id="raised-sunken-caps"><span class="secno">2.10.1. </span><span class="content"> Raised and sunken caps</span><a class="self-link" href="#raised-sunken-caps"></a></h4>
<p>An initial letter does not affect the position of its containing element. For “raised caps” or “sunken caps,” the effect is created as if the text around the initial letter was pushed down, rather than the letter extending up into previous elements.</p>
<figure>
<img alt="raised cap para after normal para" src="images/initial-letter-drop-para-compare.png" width="600">
<p class="caption">Raised cap (<code>initial-letter: 3 1</code>) 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.</p>
</figure>
<p class="issue" id="issue-f77cbeb9"><a class="self-link" href="#issue-f77cbeb9"></a> Handle glyph ink above cap height of font.</p>
<h4 class="heading settled" data-level="2.10.2" id="short-para-initial-letter"><span class="secno">2.10.2. </span><span class="content"> Short paragraphs with initial letters</span><a class="self-link" href="#short-para-initial-letter"></a></h4>
<p>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.)</p>
<figure>
<img alt="short para with initial letter" src="images/initial-letter-short-para.png" width="600">
<p class="caption">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.</p>
</figure>
<p>If the subsequent block starts with an initial letter,
establishes a new formatting context,
or specifies <a class="property" data-link-type="propdesc" href="https://drafts.csswg.org/css2/visuren.html#propdef-clear">clear</a> in the initial letter’s containing block’s start direction,
then it must clear the previous block’s initial letter.</p>
<figure>
<img alt="short para with initial letter followed by para with initial" src="images/initial-letter-short-para-initial.png" width="600">
<p class="caption">The red text is a short paragraph with an initial letter. The subsequent paragraph clears because it also has an initial letter.</p>
</figure>
<h4 class="heading settled" data-level="2.10.3" id="initial-letter-floats"><span class="secno">2.10.3. </span><span class="content"> Interaction with floats</span><a class="self-link" href="#initial-letter-floats"></a></h4>
<p>Floats always clear an initial letter when floated to the same side. When floated to the opposite side, they are pushed down to clear the initial letter only if they have specified <a class="property" data-link-type="propdesc" href="https://drafts.csswg.org/css2/visuren.html#propdef-clear">clear</a> to this side or they do not fit without overlapping the initial letter.</p>
<p class="issue" id="issue-2ad0a0cb"><a class="self-link" href="#issue-2ad0a0cb"></a> Is this the behavior we want? What if the float is on the same line as the initial letter?</p>
<h2 class="no-num heading settled" id="baseline-synthesis"><span class="content"> Appendix A: Synthesizing Baselines</span><a class="self-link" href="#baseline-synthesis"></a></h2>
<h3 class="no-num heading settled" id="baseline-synthesis-fonts"><span class="content"> A.1: Synthesizing Baselines for Text</span><a class="self-link" href="#baseline-synthesis-fonts"></a></h3>
<p>Some fonts may not contain the base 8096 line information necessary to align properly as described above.
User agents may follow these steps in the absence of a required metric:</p>
<ol>
<li>
Measure the font.
<div class="issue" id="issue-3c6d3ab2"><a class="self-link" href="#issue-3c6d3ab2"></a>Describe in more detail.
Should we document which characters in which scripts are useful,
such as lowercase "o" to measure x-height? See https://drafts.csswg.org/css-values/#ex</div>
<li>Use a heuristic for the script.
<li>
Use fallback values:
<ol>
<li>x-height: .5em;
<li>cap-height: .66em;
<li>hanging baseline: .6em;
</ol>
</ol>
<h3 class="no-num heading settled" id="baseline-synthesis-replaced"><span class="content"> A.2: Synthesizing Baselines for Replaced Content</span><a class="self-link" href="#baseline-synthesis-replaced"></a></h3>
<p class="issue" id="issue-b76fe1d3"><a class="self-link" href="#issue-b76fe1d3"></a> Copy over text from <a href="http://www.w3.org/TR/css-writing-modes-3/#replaced-baselines">CSS Writing Modes</a> and expand for additional baseline values.</p>
<p class="note" role="note">Note: Authors can use margins (positive or negative)
to adjust the alignment of replaced content within a line.</p>
<div class="example" id="example-f7450f42">
<a class="self-link" href="#example-f7450f42"></a> In this example, the author is using a set of images
to display characters that don’t exist.
<pre>img[src^="/text/"] {
height: 1em; /* Size to match adjacent text */
margin-bottom: -0.2em; /* Baseline at 20% above bottom */
}
...
&lt;p>This is some text with words written in an unencoded script:
&lt;img src="/text/ch3439.png" alt="...">
&lt;img src="/text/ch3440.png" alt="...">
&lt;img src="/text/ch3442.png" alt="...">
</pre>
</div>
<p class="note" role="note">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 <span class="css">baseline-table</span> property
that accepts ''[&lt;baseline-keyword> <a class="production css" data-link-type="type" href="https://drafts.csswg.org/css-values-3/#percentage-value">&lt;percentage></a>]+''.)</p>
<h2 class="no-num heading settled" id="ack"><span class="content"> Acknowledgments</span><a class="self-link" href="#ack"></a></h2>
<p>Special thanks goes to the initial authors,
Eric A. Meyer and Michel Suignard. </p>
<p>In additions to the authors, this specification would not have been possible without the help from: </p>
<p>David Baron, John Daggett, Stephen Deach, Sujal Parikh, Grzegorz Zygmunt, Chris Wilson, David M Brown, Bobby Tung, Shinyu Murakami, David Hyatt, Sylvain Galineau, Alan Stearns, Ted O’Connor. </p>
</main>
<h2 class="no-ref no-num heading settled" id="conformance"><span class="content"> Conformance</span><a class="self-link" href="#conformance"></a></h2>
<h3 class="no-ref heading settled" id="conventions"><span class="content"> Document conventions</span><a class="self-link" href="#conventions"></a></h3>
<p>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. </p>
<p>All of the text of this specification is normative except sections
explicitly marked as non-normative, examples, and notes. <a data-link-type="biblio" href="#biblio-rfc2119">[RFC2119]</a></p>
<p>Examples in this specification are introduced with the words "for example"
or are set apart from the normative text with <code>class="example"</code>,
like this: </p>
<div class="example" id="example-f839f6c8">
<a class="self-link" href="#example-f839f6c8"></a>
<p>This is an example of an informative example.</p>
</div>
<p>Informative notes begin with the word "Note" and are set apart from the
normative text with <code>class="note"</code>, like this: </p>
<p class="note" role="note">Note, this is an informative note.</p>
<p>Advisements are normative sections styled to evoke special attention and are
set apart from other normative text with <code>&lt;strong class="advisement"></code>, like
this: <strong class="advisement"> UAs MUST provide an accessible alternative. </strong> </p>
<h3 class="no-ref heading settled" id="conformance-classes"><span class="content"> Conformance classes</span><a class="self-link" href="#conformance-classes"></a></h3>
<p>Conformance to this specification
is defined for three conformance classes: </p>
<dl>
<dt>style sheet
<dd>A <a href="http://www.w3.org/TR/CSS21/conform.html#style-sheet">CSS
style sheet</a>.
<dt>renderer
<dd>A <a href="http://www.w3.org/TR/CSS21/conform.html#user-agent">UA</a> that interprets the semantics of a style sheet and renders
documents that use them.
<dt>authoring tool
<dd>A <a href="http://www.w3.org/TR/CSS21/conform.html#user-agent">UA</a> that writes a style sheet.
</dl>
<p>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. </p>
<p>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.) </p>
<p>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. </p>
<h3 class="no-ref heading settled" id="partial"><span class="content"> Partial implementations</span><a class="self-link" href="#partial"></a></h3>
<p>So that authors can exploit the forward-compatible parsing rules to
assign fallback values, CSS renderers <strong>must</strong> treat as invalid (and <a href="http://www.w3.org/TR/CSS21/conform.html#ignore">ignore
as appropriate</a>) any at-rules, properties, property values, keywords,
and other syntactic constructs for which they have no usable level of
support. In particular, user agents <strong>must not</strong> selectively
ignore unsupported component values and honor supported values in a single