-
Notifications
You must be signed in to change notification settings - Fork 790
Expand file tree
/
Copy pathlists.src
More file actions
418 lines (352 loc) · 14.4 KB
/
lists.src
File metadata and controls
418 lines (352 loc) · 14.4 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
417
418
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html lang="en">
<!-- $Id: lists.src,v 2.16 1998-04-04 00:25:04 ijacobs Exp $ -->
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<TITLE>Lists</TITLE>
</HEAD>
<BODY>
<H1 align="center">Lists</H1>
<H2>Visual formatting of lists</H2>
CSS allows authors to control the visual presentation of lists in a
number of ways:
<ul>
<li>Authors may specify a marker that appears before each list item.
<li>Markers may be placed outside or inside the list item's
content.
<li>Markers may be represented by predefined shapes (bullets,
circles, squares), numerals (arabic, roman, letters, etc.), or
images.
<li>With <a
href="./selector.html#descendant-selectors">descendant selectors</a>
and <a
href="./selector.html#child-selectors">child selectors</a>,
it's possible to specify different marker types depending on the depth
of embedded lists.
</ul>
<P>An element with a <span class="propinst-display">'display'</span>
property value of 'list-item' generates two boxes: a <a
href="visuren.html#block-box">block</a> box that contains its
content and an inline box that contains a marker. Only the content box
is involved with positioning (e.g, in the <a
href="visuren.html#normal-flow">normal flow</a>). The position of the
marker box (see the <span
class="propinst-list-style-position">'list-style-position'</span>
property) does not affect the position of the content box. CSS
properties allow authors to specify the marker type (image, glyph, or
number) and its position with respect to the content box (outside the
content or at the beginning of content). CSS properties do not allow
authors to specify distinct style (colors, fonts, alignment, etc.) for
the list marker.
<P>The <a href="colors.html#background-properties">background
properties</a> apply to the content box only; the marker box is
transparent.
<div class="html-example"><P>
The declaration in the following HTML program causes LI elements to
generate 'list-item' boxes. The <span
class="propinst-list-style">'list-style'</span> value 'none' suppresses
preceding markers.
<PRE>
<HTML>
<HEAD>
<STYLE type="text/css">
LI { display: list-item; list-style: none }
</STYLE>
</HEAD>
<BODY>
<UL>
<LI> This is the first list item, formatted as a block.
<LI> This is the second list item.
<LI> This is the third.
</UL>
</BODY>
</HTML>
</PRE>
<P>The list might be formatted as follows:</P>
<P><img src="./images/list-none.gif" alt="A list with no markers."></p>
<P>The illustration shows the relationship between the current left
margin and the margins and padding of the list (UL) box and the list
item (LI) boxes. (The lines delimiting the margins and padding are not
rendered).
<P>If we change the <span
class="propinst-list-style">'list-style'</span> to "square":
<PRE>
LI { display: list-item; list-style: square }
</PRE>
<P> each list item will be preceded by a small square. However, the
placement of the square does not affect the <a
href="visuren.html#block-formatting">block formatting</a> of the list
item box:</P>
<p><img src="./images/list-square.gif" alt="A list with square markers."></p>
</div>
<P>The list properties in this chapter do not allow authors to control
the separation between a list marker and the content of its list
item. Instead, this may be achieved with <a
href="generate.html#markers">markers.</a> Note that markers specified
with 'display: marker' replace list markers specified with the list
properties defined in this chapter.
<div class="note"><P>
<em><strong>Note.</strong>
There is no "list" presentation for other types of list structures
(e.g., "definition lists" declared by DL, DT, and DD in HTML). Each
part of a definition list is simply a block element.</em>
</div>
<H3><a name="list-props">List properties</a>: <span
class="propinst-list-style-type">'list-style-type'</span>, <span
class="propinst-list-style-image">'list-style-image'</span>, <span
class="propinst-list-style-position">'list-style-position'</span>, and
<span class="propinst-list-style">'list-style'</span>
</H3>
<!-- #include src=properties/list-style-type.srb -->
<P> This property specifies appearance of the list item marker if
<span class="propinst-list-style-image">'list-style-image'</span> has
the value 'none' or if the image pointed to by the URI cannot be
displayed. The value 'none' specifies no marker, otherwise there are
three types of marker: glyphs, numbering systems, and alphabetic systems.
<P>Glyphs are specified with
<strong><span class="index-def" title="disc"><a class="value-def"
name="value-def-disc">disc</a></span></strong>,
<strong><span class="index-def" title="circle"><a class="value-def"
name="value-def-circle">circle</a></span></strong>, and
<strong><span class="index-def" title="square"><a class="value-def"
name="value-def-square">square</a></span></strong>. Their exact
rendering depends on the user agent.
<P>Numbering systems are specified with:</P>
<dl>
<dt><span class="index-def" title="decimal">
<a class="value-def" name="value-def-decimal">
<strong>decimal</strong></a></span>
<dd>Decimal numbers, beginning with 1.
<dt><strong><span class="index-def" title="decimal-leading-zero"><a class="value-def" name="value-def-decimal-leading-zero">decimal-leading-zero</a></span></strong>
<dd>Decimal numbers 01, 02, 03, ... (or 001, 002, 003, ... if more than 99 items)
<dt><strong><span class="index-def" title="lower-roman"><a class="value-def" name="value-def-lower-roman">lower-roman</a></span></strong>
<dd>Lower case roman numerals (i, ii, iii, iv, v, etc.).
<dt><strong><span class="index-def" title="upper-roman"><a class="value-def" name="value-def-upper-roman">upper-roman</a></span></strong>
<dd>Upper case roman numerals (I, II, III, IV, V, etc.).
<dt><strong><span class="index-def" title="hebrew"><a class="value-def" name="value-def-hebrew">hebrew</a></span></strong>
<dd>Traditional Hebrew numbering.
<dt><strong><span class="index-def" title="georgian"><a class="value-def" name="value-def-georgian">georgian</a></span></strong>
<dd>Traditional Georgian numbering
(an, ban, gan, ..., he, tan, in, in-an, ...).
<dt><strong><span class="index-def" title="armenian"><a class="value-def" name="value-def-armenian">armenian</a></span></strong>
<dd>Traditional Armenian numbering.
<dt><strong><span class="index-def" title="cjk-ideographic"><a class="value-def" name="value-def-cjk-ideographic">cjk-ideographic</a></span></strong>
<dd>Plain ideographic numbers
<dt><strong><span class="index-def" title="hiragana"><a class="value-def" name="value-def-hiragana">hiragana</a></span></strong>
<dd>a, i, u, e, o, ka, ki, ...
<dt><strong><span class="index-def" title="katakana"><a class="value-def" name="value-def-katakana">katakana</a></span></strong>
<dd>A, I, U, E, O, KA, KI, ...
<dt><strong><span class="index-def" title="hiragana-iroha"><a class="value-def" name="value-def-hiragana-iroha">hiragana-iroha</a></span></strong>
<dd>i, ro, ha, ni, ho, he, to, ...
<dt><strong><span class="index-def" title="katakana-iroha"><a class="value-def" name="value-def-katakana-iroha">katakana-iroha</a></span></strong>
<dd>I, RO, HA, NI, HO, HE, TO, ...
</dl>
<P>A user agent that does not recognize a numbering system should use
'decimal'.
<div class="note"><P>
<em><strong>Note.</strong>
This document does not specify the exact mechanism of each
numbering system (e.g., how roman numerals are calculated).
A future W3C Note may provide further clarifications.
</em>
</div>
<P>Alphabetic systems are specified with:</P>
<dl>
<dt><strong><span class="index-def" title="lower-latin"><a class="value-def" name="value-def-lower-latin">lower-latin</a></span></strong> or <strong>lower-alpha</strong>
<dd>Lower case ascii letters (a, b, c, ... z).
<dt><strong><span class="index-def" title="upper-latin"><a class="value-def" name="value-def-upper-latin">upper-latin</a></span></strong> or <strong>upper-alpha</strong>
<dd>Upper case ascii letters (A, B, C, ... Z).
<dt><strong><span class="index-def" title="lower-greek"><a class="value-def" name="value-def-lower-greek">lower-greek</a></span></strong>
<dd>Lower case classical Greek
alpha, beta, gamma, ... (έ, ή, ί, ...)
</dl>
<P>This specification does not define how alphabetic systems wrap at
the end of the alphabet. For instance, after 26 list items,
'lower-latin' rendering is undefined. Therefore, for long lists, we
recommend that authors specify true numbers.
<div class="html-example"><P>
For example, the following HTML document:
<PRE>
<HTML>
<HEAD>
<STYLE type="text/css">
OL { list-style-type: lower-roman }
</STYLE>
</HEAD>
<BODY>
<OL>
<LI> This is the first item.
<LI> This is the second item.
<LI> This is the third item.
</OL>
</BODY>
</HTML>
</PRE>
<P>might produce something like this:
<PRE>
i This is the first item.
ii This is the second item.
iii This is the third item.
</PRE>
<P>Note that the list marker alignment (here, right justified)
depends on the user agent.
</div>
<div class="note"><P>
<em><strong>Note.</strong>
Future versions of CSS
may provide more complete
mechanisms for international numbering styles.
</em>
</div>
<!-- #include src=properties/list-style-image.srb -->
<P> This property sets the image that will be used as the list item
marker. When the image is available, it will replace the marker set
with the <span
class="propinst-list-style-type">'list-style-type'</span> marker.
<div class="example"><P>
The following example sets the marker at the beginning of each list
item to be the image "ellipse.png".
<PRE>
UL { list-style-image: url(http://png.com/ellipse.png) }
</PRE>
</div>
<!-- #include src=properties/list-style-position.srb -->
<P> This property specifies the position of the marker
box with respect to line item content box. Values have the
following meanings:</p>
<dl>
<dt><strong>outside</strong>
<dd>The list item marker is outside the box that is generated for the
list item.
<dt><strong>inside</strong>
<dd>The list item marker is the first inline box generated for the
list item. The list item's contents flow after the marker box.
</dl>
<div class="html-example"><P>
For example:
<PRE>
<HTML>
<HEAD>
<STYLE type="text/css">
UL { list-style: outside }
UL.compact { list-style: inside }
</STYLE>
</HEAD>
<BODY>
<UL>
<LI>first list item comes first
<LI>second list item comes second
</UL>
<UL class="compact">
<LI>first list item comes first
<LI>second list item comes second
</UL>
</BODY>
</HTML>
</PRE>
<P> The above example may be formatted as:</P>
<P><img src="./images/list-inout.gif" alt="Difference between inside and outside list style position"></p>
</div>
<P>In right-to-left text, the markers would have been on the right
side of the box.
<!-- #include src=properties/list-style.srb -->
<P> The <span class="propinst-list-style">'list-style'</span> property
is a shorthand notation for setting the three properties <span
class="propinst-list-style-type">'list-style-type'</span>, <span
class="propinst-list-style-image">'list-style-image'</span>, and <span
class="propinst-list-style-position">'list-style-position'</span> at
the same place in the style sheet.
<div class="example"><P>
<PRE>
UL { list-style: upper-roman inside } /* Any UL*/
UL > UL { list-style: circle outside } /* Any UL child of a UL*/
</PRE>
</div>
<P>Although authors may specify <span
class="propinst-list-style">'list-style'</span> information directly
on list item elements (e.g., LI in HTML), they should do so with
care. The following rules look similar, but the first declares a <a
href="./selector.html#descendant-selectors">descendant selector</a>
and the second a (more specific) <a
href="./selector.html#child-selectors">child
selector.</a>
<PRE class="example">
OL.alpha LI { list-style: lower-alpha } /* Any LI descendant of an OL */
OL.alpha > LI { list-style: lower-alpha } /* Any LI child of an OL */
</PRE>
<P>Authors who use only the <a
href="selector.html#descendant-selectors">descendant selector</a> may
not achieve the results they expect. Consider the following rules:
<PRE class="html-example">
<HTML>
<HEAD>
<STYLE type="text/css">
OL.alpha LI { list-style: lower-alpha }
UL LI { list-style: disc }
</STYLE>
</HEAD>
<BODY>
<OL class="alpha">
<LI>level 1
<UL>
<LI>level 2
</UL>
</OL>
</BODY>
</HTML>
</PRE>
<P>The desired rendering would have level 1 list items with
'lower-alpha' labels and level 2 items with 'disc' labels. However,
the <a href="./cascade.html#cascading-order">cascading order</a> will
cause the first style rule (which includes specific class information)
to mask the second. The following rules solve the problem by employing
a <a href="./selector.html#child-selectors">child
selector</a> instead:
<PRE class="example">
OL.alpha > LI { list-style: lower-alpha }
UL LI { list-style: disc }
</PRE>
<P>Another solution would be to specify <span
class="propinst-list-style">'list-style'</span> information only on
the list type elements:
<PRE class="example">
OL.alpha { list-style: lower-alpha }
UL { list-style: disc }
</PRE>
<P>Inheritance will transfer the <span
class="propinst-list-style">'list-style'</span> values from OL and
UL elements to LI elements. This is the recommended way to
specify list style information.
<div class="example"><P>
<P> A URI value may be combined with any other value, as in:
<PRE>
UL { list-style: url(http://png.com/ellipse.png) disc }
</PRE>
<P> In the example above, the 'disc' will be used when the image is
unavailable.
<P>With a value of 'none', both
<span class="propinst-list-style-type">'list-style-type'</span> and
<span class="propinst-list-style-image">'list-style-image'</span> are
set to 'none':
<PRE>
UL { list-style: none }
</PRE>
<P>The result is that no list-item marker is displayed.
</div>
</body>
</html>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:nil
sgml-shorttag:nil
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:nil
sgml-indent-data:t
sgml-parent-document:nil
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
-->