forked from w3c/csswg-drafts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathOverview.html
461 lines (377 loc) · 18.2 KB
/
Overview.html
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
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head profile="http://dublincore.org/documents/2008/08/04/dc-html/ ">
<title>CSS Presentation Levels Module</title>
<link href="http://purl.org/dc/terms/" rel="schema.dcterms" />
<link href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright"
rel="dcterms.rights" />
<meta content="CSS Presentation Levels Module" name="dcterms.title" />
<meta content="text" name="dcterms.type" />
<meta content="2014-11-19" name="dcterms.date" />
<meta content="Ian Hickson" name="dcterms.creator" />
<meta content="Håkon Wium Lie" name="dcterms.creator" />
<meta content="Bert Bos" name="dcterms.creator" />
<meta content="W3C" name="dcterms.publisher" />
<meta content="http://www.w3.org/TR/2014/NOTE-css3-preslev-20141119/"
name="dcterms.identifier" />
<link href="../default.css" rel="stylesheet" title="Default"
type="text/css" />
<style title="Default" type="text/css">
/* The TR postprocessor, unlike Bikeshed, already inserted quotes: */
.css::before, .property::before, .descriptor::before {content: none}
.css::after, .property::after, .descriptor::after {content: none}
</style>
<link href="https://www.w3.org/StyleSheets/TR/W3C-WG-NOTE.css"
rel="stylesheet" title="Default" type="text/css" /></head>
<body>
<div class="head">
<p><a href="http://www.w3.org/"><img alt="W3C" height="48"
src="https://www.w3.org/Icons/w3c_home" width="72" /></a></p>
<h1 id="title">CSS Presentation Levels Module</h1>
<h2 class="no-num no-toc" id="W3C-doctype">W3C Working Group Note 19
November 2014</h2>
<dl>
<dt>This version:</dt>
<dd><a
href="http://www.w3.org/TR/2014/NOTE-css3-preslev-20141119/">http://www.w3.org/TR/2014/NOTE-css3-preslev-20141119/</a></dd>
<dt>Latest version:</dt>
<dd><a
href="http://www.w3.org/TR/css3-preslev">http://www.w3.org/TR/css3-preslev</a></dd>
<dt>Previous version:</dt>
<dd><a
href="http://www.w3.org/TR/2014/NOTE-css3-preslev-20141014/">http://www.w3.org/TR/2014/NOTE-css3-preslev-20141014/</a></dd>
<dt>Feedback:</dt>
<dd><a
href="mailto:www-style@w3.org?subject=%5Bcss-preslev%5D%20feedback">www-style@w3.org</a>
with subject line “<kbd>[css-preslev] <var>… message topic
…</var></kbd>” (<a
href="http://lists.w3.org/Archives/Public/www-style/"
rel="discussion">archives</a>)</dd>
<dt>Editors:</dt>
<dd><a href="http://ian.hixie.ch/" lang="en">Ian Hickson</a>
<ian @hixie.ch></dd>
<dd><a href="http://people.opera.com/howcome/" lang="no">Håkon Wium
Lie</a> <howcome @opera.com></dd>
<dd><a href="http://www.w3.org/People/Bos/" lang="nl">Bert Bos</a> (W3C)
<bert @w3.org></dd>
</dl>
<!--begin-copyright-->
<p class="copyright"><a
href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright"
rel="license">Copyright</a> © 2014 <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>), All Rights Reserved. W3C <a
href="http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>,
<a
href="http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a>
and <a
href="http://www.w3.org/Consortium/Legal/copyright-documents">document
use</a> rules apply.</p>
<!--end-copyright-->
<hr title="Separator for header" />
</div>
<h2 class="no-num no-toc" id="abstract">Abstract</h2>
<p>Presentation levels are integer values attached to elements in a
document. Elements that are below, at, or above a certain threshold can be
styled differently. This feature has two compelling use cases. First,
slide presentations with transition effects can be described. For example,
list items can be progressively revealed by sliding in from the side.
Second, outline views of documents, where only the headings to a certain
level are visible, can be generated.</p>
<h2 class="no-num no-toc" id="status">Status of This Document</h2>
<!--begin-status-->
<p><em>This section describes the status of this document at the time of
its publication. Other documents may supersede this document. A list of
current W3C publications and the latest revision of this technical report
can be found in the <a href="http://www.w3.org/TR/">W3C technical reports
index at http://www.w3.org/TR/.</a></em></p>
<p>Publication as a Working Group Note does not imply endorsement by the
W3C Membership. This is a draft document and may be updated, replaced or
obsoleted by other documents at any time. It is inappropriate to cite this
document as other than work in progress.</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>The (<a
href="http://lists.w3.org/Archives/Public/www-style/">archived</a>) public
mailing list <a
href="mailto:www-style@w3.org?Subject=%5Bcss3-preslev%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 document. When sending e-mail, please put
the text “css3-preslev” in the subject, preferably like this:
“[<!---->css3-preslev<!---->] <em>…summary of comment…</em>”</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>
<!--end-status-->
<p class="mtb"><em>At this time, the CSS Working Group does not envisage
further work on this specification and does not plan to propose it as a
W3C Recommendation.</em></p>
<nav id="toc">
<h2 class="no-num no-toc" id="contents">Table of contents</h2>
<!--begin-toc-->
<ul class="toc">
<li><a href="#themodel"><span class="secno">1. </span>The model</a></li>
<li><a href="#presentation-level-property"><span class="secno">2.
</span>The ‘<code class="property">presentation-level</code>’
property</a></li>
<li><a href="#example1"><span class="secno">3. </span>Example 1:
progressively revealing list items</a></li>
<li><a href="#example2"><span class="secno">4. </span>Example 2:
presenting outline views of a document</a></li>
<li><a href="#dom"><span class="secno">5. </span>Presentation levels and
the DOM</a></li>
</ul>
<!--end-toc-->
</nav>
<h2 id="themodel"><span class="secno">1. </span>The model</h2>
<p>Content reuse has been one of the main motivations for the development
of style sheets. By associating documents with different style sheets, the
same content can be presented in different ways. The introduction of
<em>presentation levels</em> in CSS adds functionality which is very
useful in two particular settings. First, slide presentations with
transition effects can be described. For example, list items can be
progressively revealed by sliding in from the side. Second, outline views
of documents, where only the headings to a certain level are visible, can
be generated.</p>
<p>The model behind presentation levels is simple. Each element in the
document is assigned an integer value which is referred to as the
"element's presentation level" (EPL). The EPL can be set explicitly in a
style sheet or calculated automatically based on the element's position in
the document structure: it is specified by the computed value of the <a
class="property" href="#presentation-level">‘<code
class="property">presentation-level</code>’</a> property. The User Agent
maintains another integer value which is called the User Agent
Presentation Value (UAPL). The UAPL starts at a UA-defined value,
typically 0.</p>
<p>All elements are in one of three presentation pseudo-classes: <span
class="css">‘<code class="property">below-level</code>’</span>, <span
class="css">‘<code class="property">at-level</code>’</span>, and <span
class="css">‘<code class="property">above-level</code>’</span>. These
pseudo-classes refer to whether the element's EPL was below, at, or above
the UAPL the last time the UAPL changed. When an element's state is
evaluated, the EPL is compared to the UAPL and pseudo-classes are assigned
as follows: If the EPL is equal to 0, the element is always in the
below-level state. If the EPL is lower than the UAPL value, it is set to
the ‘<code class="property">below-level</code>’ state, if the EPL is
exactly that value it is set to ‘<code
class="property">at-level</code>’, and if the EPL is greater than that
value it is set to ‘<code class="property">above-level</code>’.</p>
<p>Here is an example of a style sheets using the presentation
pseudo-classes:</p>
<pre>
:below-level { color: black }
:at-level { color: red }
:above-level { color: silver }
</pre>
<p>This proposal does not describe the user interface of presentation
levels. The user agent will need to provide a user interface for setting
the UAPL. For example, in projection mode, a user agent may increase the
UAPL every time the user hits the space bar. When the user moves to
another page (for example by following a hyperlink), the user agent may
set the UAPL to be the same as presentation level of the first element on
the page. In outline mode, the user agent may provide a vertical slider on
the side to increase/decrease the UAPL.</p>
<h2 id="presentation-level-property"><span class="secno">2. </span>The
‘<a href="#presentation-level"><code
class="property">presentation-level</code></a>’ property</h2>
<table class="propdef">
<tbody>
<tr>
<td><em>Name:</em></td>
<td><dfn id="presentation-level">presentation-level</dfn></td>
</tr>
<tr>
<td><em>Value:</em></td>
<td><integer> | same | increment</td>
</tr>
<tr>
<td><em>Initial:</em></td>
<td>0</td>
</tr>
<tr>
<td><em>Applies to:</em></td>
<td>all elements</td>
</tr>
<tr>
<td><em>Inherited:</em></td>
<td>yes</td>
</tr>
<tr>
<td><em>Percentages:</em></td>
<td>N/A</td>
</tr>
<tr>
<td><em>Computed value:</em></td>
<td>integer</td>
</tr>
</tbody>
</table>
<p class=all-media>User Agents are expected to support this property on all media, including non-visual ones.</p>
<p>This property sets the element's presentation level (EPL). The values
have the following meanings:</p>
<ul>
<li>An integer value sets the presentation level explicitly.</li>
<li>A value of <span class="css">‘<code
class="property">increment</code>’</span> computes to a value one more
than the previous (in document order) element's presentation level.</li>
<li>A value of <span class="css">‘<code
class="property">same</code>’</span> computes to the same value as the
previous element's (in document order) presentation level. For the root
element, <span class="css">‘<code
class="property">same</code>’</span> computes to zero.</li>
</ul>
<h2 id="example1"><span class="secno">3. </span>Example 1: progressively
revealing list items</h2>
<p>Here is an example of how presentation levels can be used to
progressively reveal list items while high-lighting the current one.</p>
<pre>
EPL value
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
<HTML> 0
<STYLE> 0
html { color: black; background: white }
@media projection {
h1 { page-break-before: always }
li { presentation-level: increment }
:below-level { color: black }
:at-level { color: red }
:above-level { color: silver }
}
</STYLE>
<BODY> 0
<H1>Strategies</H1> 0
<H2>Our strategy</H2> 0
<UL> 0
<LI>divide 1
<LI>conquer 2
<P>(in that order) 2
</UL>
<H2>Their strategy</H2> 0
<UL> 0
<LI>obfuscate 1
<LI>propagate 2
</UL>
</pre>
<p>In the example above, the LI elements' EPL value is increased with one
compared to the previous element. The other elements' EPL value is the
same as the previous element due to the initial <span class="css">‘<code
class="property">same</code>’</span> value of the <a class="property"
href="#presentation-level">‘<code
class="property">presentation-level</code>’</a> property.</p>
<h2 id="example2"><span class="secno">4. </span>Example 2: presenting
outline views of a document</h2>
<p>Here is an example of how presentation levels can be used to present
outline views of a document:</p>
<pre>
EPL value
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
<HTML> 0
<STYLE>
h1 { presentation-level: 0; }
h2 { presentation-level: 1; }
h3 { presentation-level: 2; }
body * { presentation-level: 3; }
:above-level { display: none; }
</STYLE>
<BODY> 0
<H1>Strategies</H1> 3
<H2>Our strategy</H2> 2
<UL> 0
<LI>divide 0
<LI>conquer 0
<P>(in that order) 0
</UL>
<H2>Their strategy</H2> 2
<UL> 0
<LI>obfuscate 0
<LI>propagate 0
</UL>
</pre>
<h2 id="dom"><span class="secno">5. </span>Presentation levels and the DOM</h2>
<p>An element's state is first evaluated when it is created. When the UAPL
is changed, all elements in the document have their state reevaluated. A
CSSNowBelowLevel event is then sent to all elements that changed to the
‘<code class="property">below-level</code>’ state, a CSSNowAtLevel
event is then sent to all elements that changed to the ‘<code
class="property">at-level</code>’ state, and a CSSNowAboveLevel event is
then sent to all elements that changed to the ‘<code
class="property">above-level</code>’ state. Changing an element's ‘<a
href="#presentation-level"><code
class="property">presentation-level</code></a>’ property, e.g. through
the DOM or using a dynamic pseudo-class, does not cause the element's
state to be immediately reevaluated.</p>
<p>These events have the following characteristics:</p>
<ul>
<li>Bubbles: Yes</li>
<li>Cancelable: No</li>
<li>Context Info: detail (the UAPL)</li>
</ul>
<p>SMIL can be used with this event to declaratively key animations from
user requests, based on the ‘<code
class="property">presentation-index</code>’ property.</p>
<p>The events are defined as:</p>
<pre>
interface CSSNowBelowLevel : UIEvent { }
interface CSSNowAtLevel : UIEvent { }
interface CSSNowAboveLevel : UIEvent { }
</pre>
<p>These three fragments together will cause a document to have three
user-triggered list items, which will scroll in one at a time each time
the user hits the space bar (or whatever mechanism the UA uses), with the
current item colored white and the past items colored gray.</p>
<p>Markup:</p>
<pre>
<ol>
<li> The Separation of Style and Structure </li>
<li> Declarative User Interaction </li>
<li> Potential for Animation </li>
</ol>
</pre>
<p>Stylesheet:</p>
<pre>
ol { overflow: hidden; }
li { presentation-level: increment; margin-left: 100%; }
li:at-level { color: white; }
li:above-level { color: silver; }
</pre>
<p>Script:</p>
<pre>
// When the element is shown, scroll it in from the right
// by animating the margin-left property from 100% to 0%
document.documentElement.addEventListener('CSSNowAtLevel', handler, false);
function handler(event) {
// animateFloat is a (fictional) library routine which takes
// five arguments:
// a CSSValue to animate
// the start value
// the end value
// the time over which to animate the property, in milliseconds
// the units to animate it with
// it returns straight away and performs the animation in the
// background.
animateFloat(document.getOverrideStyle(event.target,
null).getPropertyCSSValue('margin-left'),
100, 0, 1000, CSS_PERCENTAGE);
}
</pre>
</body>
</html>