2323 padding : 2px 0 ; }
2424 # letter-spacing-example span { border : 1px solid; }
2525
26+ /* Start Letter-spacing Tutorial */
2627 .ls-ex {
2728 font-size : 200% ;
2829 margin-left : 1em ;
30+ margin-right : 1em ;
2931 }
3032 .ls-fixed-width {
3133 width : 10em ;
3234 }
33- .ls-right {
34- text-align : right;
35- }
36- .ls-1emsp {
37- display : inline-block;
38- width : 1em ;
39- }
40- .ls-2emsp {
41- display : inline-block;
42- width : 2em ;
43- }
44- .ls-bg-border { background-color : rgb (224 , 203 , 82 ); }
45- .ls-1em { letter-spacing : 1em ; }
46- .ls-2em { letter-spacing : 1em ; }
35+ .color-box { background : rgb (224 , 203 , 82 ); }
36+ .bad { color : red; }
37+ .good { color : green; }
38+ /* End Letter-spacing Tutorial */
4739
4840 .char { border : 1px dotted gray; }
4941 .quarter { font-size : 25% ; }
@@ -2070,77 +2062,71 @@ <h3 id="letter-spacing">
20702062 German, for example, avoids letter-spacing for justification because it's used for emphasis.
20712063 See < a href ="http://lists.w3.org/Archives/Public/www-style/2013May/0280.html "> this thread</ a > .
20722064
2065+ < p > For the purpose of 'letter-spacing', each consecutive run of atomic
2066+ inlines (such as images and inline blocks) is treated as a single
2067+ < i > character</ i > .
2068+
20732069 < p > Letter-spacing must not be applied at the beginning or at the end of a line.
2074- The total letter spacing between two adjacent < i > characters</ i > (after bidi reordering)
2075- is specified by and rendered within
2076- the innermost element that < em > contains</ em > the boundary between the two < i > characters</ i > .
20772070
2078- < div class ="example " id ="letter-spacing-example ">
2079- < p > For example, given the markup</ p >
2071+ < div class ="example ">
2072+ < p > Because letter-spacing is not applied at the beginning or end of a line,
2073+ text always fits flush with the edge of the block.
2074+ < pre >
2075+ <!-- --> p { letter-spacing: 1em; }
20802076
2081- < pre > < span class =" P " > <P>a < span class =" LS " > <LS>b < span class =" Z " > <Z>cd</Z> </ span > < span class =" Y " > <Y>ef</Y> </ span > </LS> </ span > g</P> </ span > </ pre >
2077+ <!-- -- > <p > abc </p > </ pre >
20822078
2083- < p > and the style sheet</ p >
2079+ < p class ="ls-ex good ls-fixed-width color-box " style ="text-align: left "> a b c</ p >
2080+ < p class ="ls-ex good ls-fixed-width color-box " style ="text-align: right "> a b c</ p >
20842081
2085- < pre > <!--
2086- --> LS { letter-spacing: 1em; }
2087- <!-- --> Z { letter-spacing: 0.3em; }
2088- <!-- --> Y { letter-spacing: 0.4em; }</ pre >
2082+ < p > UAs therefore must not append letter spacing to the right or trailing edge of a line:</ p >
20892083
2090- < p > the spacing would be as [noted] below:</ p >
2084+ < p class ="ls-ex bad ls-fixed-width color-box " style ="text-align: right "> a b c </ p >
2085+ </ div >
20912086
2092- < pre > < span class ="P "> a[0]< span class ="LS "> b[1em]< span class ="Z "> c[0.3em]d</ span > [1em]< span class ="Y "> e[0.4em]f</ span > </ span > [0]g</ span > </ pre >
2093- </ div >
2087+ Letter spacing between two < i > characters</ i > effectively “belongs”
2088+ to the innermost element element that contains the two < i > characters</ i > :
2089+ the total letter spacing between two adjacent < i > characters</ i > (after bidi reordering)
2090+ is specified by and rendered within
2091+ the innermost element that < em > contains</ em > the boundary between the two < i > characters</ i > .
20942092
20952093 < div class ="example ">
2096- < p > The inline box used to define backgrounds and borders for a given element
2097- only includes letter spacing between characters completely contained within that element:
2098-
2094+ < p > A given value of 'letter-spacing' only affects the spacing
2095+ between characters completely contained within the element for which it is specified :
2096+
20992097 < pre >
21002098<!-- --> p { letter-spacing: 1em; }
2099+ <!-- --> span { letter-spacing: 2em; }
21012100
21022101<!-- --> <p> a<span> bb</span> c</p> </ pre >
21032102
2104- < p class ="ls-ex good "> a< span class ="ls-1emsp " > </ span > < span class =" ls-bg-border " > b < span class =" ls-1emsp " > </ span > b</ span > < span class =" ls-1emsp " > </ span > c</ p >
2103+ < p class ="ls-ex "> a  < span class ="color-box " > b   b</ span >   c</ p >
21052104
2106- < p > It is incorrect to include the letter spacing on the right or trailing edge of the element:
2107-
2108- < p class =" ls-ex bad " > a < span class =" ls-1emsp " > </ span > < span class =" ls-bg-border " > b < span class =" ls-1emsp " > </ span > b < span class =" ls-1emsp " > </ span > </ span > c </ p >
2105+ < p > This also means that applying ' letter- spacing' to
2106+ an element containing only a single character
2107+ has no effect on the rendered result:
21092108
2110- < p > Letter spacing is never applied at the beginning or end of a line:</ p >
21112109 < pre >
21122110<!-- --> p { letter-spacing: 1em; }
2111+ <!-- --> span { letter-spacing: 2em; }
21132112
2114- <!-- --> <p> abc</p> </ pre >
2115-
2116- < p class ="ls-ex good ls-fixed-width ls-bg-border "> a< span class ="ls-1emsp "> </ span > b< span class ="ls-1emsp "> </ span > c</ p >
2117- < p class ="ls-ex good ls-fixed-width ls-bg-border ls-right "> a< span class ="ls-1emsp "> </ span > b< span class ="ls-1emsp "> </ span > c</ p >
2118-
2119- < p > It is incorrect to append letter spacing to the trailing edge of lines:</ p >
2113+ <!-- --> <p> a<span> b</span> c</p> </ pre >
21202114
2121- < p class ="ls-ex bad ls-fixed-width ls-bg-border ls-right "> a< span class ="ls-1emsp " > </ span > b < span class =" ls-1emsp " > < /span > c < span class =" ls-1emsp " > </ span > </ p >
2115+ < p class ="ls-ex "> a  < span class ="color-box " > b < /span >  c </ p >
21222116
2123- < p > A given value of 'letter-spacing' only affects the spacing
2124- between characters completely contained within the element for which it is specified :
2117+ < p > An inline box only includes
2118+ letter spacing between characters completely contained within that element:
21252119
21262120 < pre >
21272121<!-- --> p { letter-spacing: 1em; }
2128- <!-- --> span { letter-spacing: 2em; }
21292122
21302123<!-- --> <p> a<span> bb</span> c</p> </ pre >
21312124
2132- < p class ="ls-ex "> a< span class ="ls-1emsp "> </ span > < span class ="ls-bg-border "> b< span class ="ls-2emsp "> </ span > b</ span > < span class ="ls-1emsp "> </ span > c</ p >
2133-
2134- < p > This also means that applying 'letter-spacing' to an element containing only a single character
2135- has no effect on the rendered result:
2136-
2137- < pre >
2138- <!-- --> p { letter-spacing: 1em; }
2139- <!-- --> span { letter-spacing: 2em; }
2125+ < p class ="ls-ex good "> a < span class ="color-box "> b b</ span >  c</ p >
21402126
2141- <p > a<span > b</span > c</p > </ pre >
2127+ < p > It is incorrect to include the letter spacing on the right or trailing edge of the element:
21422128
2143- < p class ="ls-ex "> a< span class ="ls-1emsp " > </ span > < span class =" ls-bg-border " > b </ span > < span class =" ls-1emsp " > </ span > c</ p >
2129+ < p class ="ls-ex bad "> a  < span class ="color-box " > b b  </ span > c</ p >
21442130
21452131 < p > Letter spacing is inserted < strong > after</ strong > RTL reordering,
21462132 so the letter spacing applied to the inner span below has no effect,
@@ -2149,21 +2135,19 @@ <h3 id="letter-spacing">
21492135<!-- --> p { letter-spacing: 1em; }
21502136<!-- --> span { letter-spacing: 2em; }
21512137
2152- <!-- --> <!-- abc followed by Hebrew letters alef, bet and gimel
2153- <!-- --> reordering will display these in reverse order -->
2154- <!-- --> <p> ab<span> c&#x5d0;</span> &#x5d1;&#x5d2;</p>
2155- <!-- --> <span> b</span> c</p> </ pre >
2138+ <!-- --> <!-- abc followed by Hebrew letters alef (א), bet (ב) and gimel (ג) -->
2139+ <!-- --> <!-- Reordering will display these in reverse order. -->
2140+ <!-- --> < bdo dir =ltr > <p> ab<span> cא</span> בג</p> </ bdo > </ pre >
21562141
2157- < p class ="ls-ex "> a< span class =" ls-1emsp " > </ span > b</ span > < span class ="ls-1emsp " > </ span > < span class =" ls-bg-border " > c</ span > < span class ="ls-1emsp " > </ span > < span class =" ls-bg-border " > א</ span > < span class =" ls-1emsp " > </ span > & #x5d1;< span class =" ls-1emsp " > </ span > ג</ p >
2142+ < p class ="ls-ex "> a  b</ span >   < span class ="color-box " > c</ span >   < span class ="color-box " > א</ span >  & #x5d1;  ג</ p >
21582143 </ div >
21592144
21602145 < p > Letter-spacing ignores zero-width characters (such as those from the
2161- Unicode Cf category). For example, 'letter-spacing' applied to
2162- < code > A&zwsp;B</ code > is identical to < code > AB</ code > .
2163-
2164- < p > For the purpose of 'letter-spacing', each consecutive run of atomic
2165- inlines (such as images and inline blocks) is treated as a single
2166- < i > character</ i > .
2146+ Unicode Cf category).
2147+
2148+ < p class ="example "> For example, 'letter-spacing' applied to
2149+ < code > A&zwsp;B</ code > is identical to < code > AB</ code > ,
2150+ regardless of where any element boundaries might fall.
21672151
21682152 < p > When the effective letter-spacing between two characters is not zero
21692153 (due to either < a href ="#text-justify "> justification</ a >
0 commit comments