forked from w3c/csswg-drafts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtext.src
More file actions
416 lines (366 loc) · 14.3 KB
/
text.src
File metadata and controls
416 lines (366 loc) · 14.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
"http://www.w3.org/TR/1998/REC-html40-19980424/loose.dtd">
<html lang="en">
<!-- $Id: text.src,v 2.37 2003-03-21 15:57:53 bbos Exp $ -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Text</title>
<!-- Changed by: Tantek Celik, 2003-03-03 -->
<style type="text/css">
.current,.proposed { background:#feb }
ins.proposed { background:#bfb }
del.proposed { background:#fbb }
body>del,body>ins {display:block}
</style>
</head>
<body>
<h1>Text</h1>
<p>The properties defined in the following sections affect the visual
presentation of characters, spaces, words, and paragraphs.
</p>
<h2><a name="indentation-prop">Indentation</a>: the <span
class="propinst-text-indent">'text-indent'</span> property</h2>
<!-- #include src=properties/text-indent.srb -->
<p>This property specifies the indentation of the first line of text
in a block. More precisely, it specifies the indentation of the
first box that flows into the block's first <a
href="visuren.html#line-box">line box</a>. The box is indented with
respect to the left (or right, for right-to-left layout) edge of the
line box. User agents should render this indentation as blank space.
</p>
<p>Values have the following meanings:</p>
<dl>
<dt><span class="index-inst" title="<length>"><span
class="value-inst-length"><length></span></span></dt>
<dd>The indentation is a fixed length.</dd>
<dt><span class="index-inst" title="<percentage>"><span
class="value-inst-percentage"><percentage>
</span></span></dt>
<dd>The indentation is a percentage of the containing
block width.</dd>
</dl>
<p>The value of <span
class="propinst-text-indent">'text-indent'</span> may be negative, but
there may be implementation-specific limits. If the value of <span
class="propinst-text-indent">'text-indent'</span> is negative, the
value of <span class="propinst-overflow">'overflow'</span> will affect
whether the text is visible.
</p>
<div class="example"><p>
The following example causes a '3em' text indent.
</p>
<pre>
p { text-indent: 3em }
</pre>
</div>
<p class="note">
Note: Since the 'text-indent' property inherits, when specified on
a block element, it will affect descendent inline-block elements.
For this reason, it is often wise to specify '<code>text-indent: 0</code>'
on elements that are specified '<code>display:inline-block</code>'.
</p>
<h2><a name="alignment-prop">Alignment:</a> the <span
class="propinst-text-align">'text-align'</span> property</h2>
<!-- #include src=properties/text-align.srb -->
<p>This property describes how inline content of a block is aligned. Values
have the following meanings:</p>
<dl>
<dt>left, right, center, justify</dt>
<dd>Left, right, center, and justify text, respectively.</dd>
</dl>
<p>A block of text is a stack of <a href="visuren.html#line-box">line
boxes</a>. In the case of 'left', 'right' and 'center', this property specifies
how the inline boxes within each line box align with respect to the line
box's left and right sides; alignment is not with respect to the <a
href="visuren.html#viewport">viewport</a>. In the case of 'justify',
the UA may stretch the inline boxes in addition to adjusting their
positions. (See also <span
class="propinst-letter-spacing">'letter-spacing'</span> and <span
class="propinst-word-spacing">'word-spacing'</span>.)
</p>
<div class="example"><p>
In this example, note that since <span
class="propinst-text-align">'text-align'</span> is inherited, all
block-level elements inside the DIV element with 'class=important' will
have their inline content centered.
</p>
<pre>
div.important { text-align: center }
</pre>
</div>
<div class="note"><p>
<em><strong>Note.</strong>
The actual justification algorithm used depends on the user-agent and the language/script
of the text.</em>
</p>
<p><em><span class="index-inst" title="conformance"><a
href="conform.html#conformance">Conforming user agents</a></span> may
interpret the value 'justify' as 'left' or 'right', depending on
whether the element's default writing direction is left-to-right or
right-to-left, respectively.</em>
</p>
</div>
<h2>Decoration</h2>
<h3><a name="lining-striking-props">Underlining, overlining, striking, and
blinking</a>: the <span
class="propinst-text-decoration">'text-decoration'</span>
property</h3>
<!-- #include src=properties/text-decoration.srb -->
<p> This property describes decorations that are added to the text of
an element. If the property is specified for a <a
href="visuren.html#block-level">block-level</a> element, it affects
all inline-level descendants of the element. If it is specified for (or
affects) an <a href="visuren.html#inline-level">inline-level</a> element, it
affects all boxes generated by the element. If the element has no
content or no text content (e.g., the IMG element in HTML), user
agents must <a href="syndata.html#ignore">ignore</a> this property.
</p>
<p>Values have the following meanings:</p>
<dl>
<dt>none</dt>
<dd>Produces no text decoration.</dd>
<dt>underline</dt>
<dd>Each line of text is underlined.</dd>
<dt>overline</dt>
<dd>Each line of text has a line above it.</dd>
<dt>line-through</dt>
<dd>Each line of text has a line through the middle.</dd>
<dt>blink</dt>
<dd>Text blinks (alternates between visible and invisible).
<a href="conform.html#conformance">Conforming user agents</a>
may simply not blink the text. Note that not blinking the text
is one technique to satisfy
<a href="http://www.w3.org/TR/UAAG/guidelines.html#tech-on-off-blinking-text">checkpoint 3.3 of WAI-UAAG</a>.</dd>
</dl>
<p> The color(s) required for the text decoration must be derived
from the <span class="propinst-color">'color'</span> property value.
</p>
<p> This property is not inherited, but descendant boxes of a
block box should be formatted with the same decoration (e.g.,
they should all be underlined). The color of decorations should remain
the same even if descendant elements have different <span
class="propinst-color">'color'</span> values.
</p>
<div class="example"><p>
In the following example for HTML, the text content of all
A elements acting as hyperlinks (whether visited or not) will be underlined:</p>
<pre>
a:visited,a:link { text-decoration: underline }
</pre>
</div>
<h2><a name="spacing-props">Letter and word spacing</a>: the <span
class="propinst-letter-spacing">'letter-spacing'</span> and <span
class="propinst-word-spacing">'word-spacing'</span> properties</h2>
<!-- #include src=properties/letter-spacing.srb -->
<p>This property specifies spacing behavior between
text characters. Values have the following meanings:</p>
<dl>
<dt>normal</dt>
<dd>The spacing is the normal spacing for the current font.
This value allows the user agent to alter the space
between characters in order to justify text.</dd>
<dt><span class="index-inst" title="<length>"><span
class="value-inst-length"><length></span></span></dt>
<dd>This value indicates inter-character space <em>in
addition to</em> the default space between
characters. Values may be negative, but there may be
implementation-specific limits.
User agents may not further increase or decrease the inter-character
space in order to justify text.</dd>
</dl>
<p>Character spacing algorithms are user agent-dependent. Character
spacing may also be influenced by justification (see the <span
class="propinst-text-align">'text-align'</span> property).
</p>
<div class="example"><p>
In this example, the space between characters in
BLOCKQUOTE elements is increased by '0.1em'.
</p>
<pre>
blockquote { letter-spacing: 0.1em }
</pre>
<p>In the following example, the user agent is not permitted
to alter inter-character space:</p>
<pre>
blockquote { letter-spacing: 0cm } /* Same as '0' */
</pre>
</div>
<p> When the resultant space between two characters is not the same as
the default space, user agents should not use
<span class="index-inst" title="ligatures">ligatures.</span>
</p>
<!-- #include src=properties/word-spacing.srb -->
<p>This property specifies spacing behavior between words.
Values have the following meanings:</p>
<dl>
<dt>normal</dt>
<dd>The normal inter-word space, as defined by the current font and/or
the <abbr title="user agent">UA</abbr>.</dd>
<dt><span class="index-inst" title="<length>"><span
class="value-inst-length"><length></span></span></dt>
<dd>This value indicates inter-word space <em>in
addition to</em> the default space between
words. Values may be negative, but there may be
implementation-specific limits. </dd>
</dl>
<p>Word spacing algorithms are user agent-dependent. Word spacing is
also influenced by justification (see the <span
class="propinst-text-align">'text-align'</span> property).
</p>
<div class="example"><p>
In this example, the word-spacing between each word in H1 elements is
increased by '1em'.
</p>
<pre>
h1 { word-spacing: 1em }
</pre>
</div>
<h2><a name="caps-prop">Capitalization</a>: the <span
class="propinst-text-transform">'text-transform'</span> property</h2>
<!-- #include src=properties/text-transform.srb -->
<p>This property controls capitalization effects of
an element's text. Values have the following meanings:</p>
<dl>
<dt>capitalize</dt>
<dd>Puts the first character of each word in uppercase.</dd>
<dt>uppercase</dt>
<dd>Puts all characters of each word in uppercase.</dd>
<dt>lowercase</dt>
<dd>Puts all characters of each word in lowercase.</dd>
<dt>none</dt>
<dd>No capitalization effects.</dd>
</dl>
<p> The actual transformation in each case is written language
dependent. See RFC 2070 ([[RFC2070]]) for ways to find the language of
an element.
</p>
<p><span class="index-inst" title="conformance"><a
href="conform.html#conformance">Conforming user agents</a></span>
may consider the value of <span
class="propinst-text-transform">'text-transform'</span> to be 'none'
for characters that are not from the Latin-1 repertoire and for
elements in languages for which the transformation is different from
that specified by the case-conversion tables of ISO 10646
([[ISO10646]]).
</p>
<div class="example"><p>
In this example, all text in an H1 element is transformed to uppercase
text.
</p>
<pre>
h1 { text-transform: uppercase }
</pre>
</div>
<h2><a name="white-space-prop">Whitespace</a>: the <span
class="propinst-white-space">'white-space'</span> property</h2>
<!-- #include src=properties/white-space.srb -->
<p> This property declares how <a
href="syndata.html#whitespace">whitespace</a> inside the element is
handled. Values have the following meanings:</p>
<!-- See the HTML definition of whitespace -IJ -->
<dl>
<dt>normal</dt>
<dd>This value directs user agents to collapse sequences
of whitespace, and break lines as necessary to fill line boxes.</dd>
<dt>pre</dt>
<dd>This value prevents user agents from collapsing sequences
of whitespace. Lines are only broken at newlines in the source, or
at occurrences of "\A" in generated content.</dd>
<dt>nowrap</dt>
<dd>This value collapses whitespace as for 'normal', but suppresses
line breaks within text.</dd>
<dt>pre-wrap</dt>
<dd>This value prevents user agents from collapsing sequences
of whitespace. Lines are broken at newlines in the source,
at occurrences of "\A" in generated content,
and as necessary to fill line boxes.</dd>
<dt>pre-line</dt>
<dd>This value collapses whitespace as for 'normal', except
occurrences of newlines in the source or "\A" in generated content
do cause line breaks.</dd>
</dl>
<div class="example"><p> The following examples show what <a
href="syndata.html#whitespace">whitespace</a> behavior is expected
from the PRE and P elements, the "nowrap" attribute in HTML, and
in generated content.
</p>
<pre>
pre { white-space: pre }
p { white-space: normal }
td[nowrap] { white-space: nowrap }
:before,:after { white-space: pre-line }
</pre>
<p>In addition, the effect of an HTML PRE element with the <em>non-standard</em> "wrap" attribute is demonstrated by the following example:
</p>
<pre>
pre[wrap] { white-space: pre-wrap }
</pre>
</div>
<h3 id="white-space-model">The 'white-space' processing model</h3>
<p>
Any text that is directly contained inside a block (not inside an
inline) should be treated as an anonymous inline element.
</p>
<p>
For each inline (including anonymous inlines), the following steps are
performed, ignoring bidi formatting characters as if they were not
there:
</p>
<ol>
<li>Each non-linefeed whitespace character surrounding a linefeed
character is removed if 'white-space' is set to 'normal',
'no-wrap', or 'pre-line'.
</li>
<li>If 'white-space' is set to 'pre' or 'pre-wrap', any sequence of
spaces (U+0020) unbroken by an element boundary is treated as a
sequence of non-breaking spaces. However, a line breaking
opportunity exists at the end of the sequence.
</li>
<li>If 'white-space' is set to 'normal' or 'nowrap', linefeed
characters are transformed for rendering purpose into one of the
following characters: a space character, a zero width space
character (U+200B), or no character (i.e. not rendered),
according to UA-specific algorithms based on the content script.
</li>
<li>If 'white-space' is set to 'normal', 'nowrap', or 'pre-line',
<ol><li> every tab (U+0009) is converted to a space (U+0020)</li>
<li> any space (U+0020) following another space (U+0020) — even
a space before the inline, if that space also has
'white-space' set to 'normal', 'nowrap' or 'pre-line' — is removed.</li>
</ol>
</li>
</ol>
<p>
Then, the entire block is rendered. Inlines are laid out, taking bidi
reordering into account, and wrapping as specified by the
'white-space' property.
</p>
<p>
As each line is laid out,
</p>
<ol>
<li>If a space (U+0020) at the beginning of a line has 'white-space'
set to 'normal', 'nowrap', or 'pre-line', it is removed.
</li>
<li>All tabs (U+0009) are rendered as a horizontal shift that lines
up the start edge of the next glyph with the next tab stop. Tab
stops occur at points that are multiples of 8 times the width of
a space (U+0020) rendered in the block's font from the block's
starting content edge.
</li>
<li>If a space (U+0020) at the end of a line has 'white-space' set to
'normal', 'nowrap', or 'pre-line', it is also removed.
</li>
</ol>
</body>
</html>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-declaration:"~/SGML/HTML4.decl"
sgml-default-doctype-name:"html"
sgml-minimize-attributes:t
sgml-nofill-elements:("pre" "style" "br")
sgml-live-element-indicator:t
End:
-->