-
Notifications
You must be signed in to change notification settings - Fork 708
/
Copy pathvisufx.src
439 lines (386 loc) · 15.5 KB
/
visufx.src
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
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html lang="en">
<head>
<title>Visual effects</title>
<!--script src="http://www.w3c-test.org/css/harness/annotate.js#CSS21_DEV" type="text/javascript" defer></script-->
<style type="text/css">
.current,.proposed,span.delcurrent { background:#feb }
ins.proposed,span.insproposed { background:#bfb }
del.proposed,span.delproposed { background:#fbb }
span.insproposed { text-decoration:underline }
span.delproposed,span.delcurrent { text-decoration:line-through }
body>del,body>ins {display:block}
</style>
</head>
<body>
<h1>Visual effects</h1>
<h2><a name="overflow-clipping">Overflow and clipping</a></h2>
<p>Generally, the content of a block box is confined to the
content edges of the box. In certain cases, a box may <span
class="index-def"
title="overflow|box::overflow"><dfn>overflow</dfn></span>, meaning its
content lies partly or entirely outside of the box, e.g.:</p>
<ul>
<li>A line cannot be broken, causing the line box to be wider than the
block box.
</li>
<li>A block-level box is too wide for the containing block. This may
happen when an
element's <span class="propinst-width">'width'</span> property has a
value that causes the generated block box to spill over
sides of the containing block.
</li>
<li>An element's height exceeds an explicit height assigned to the containing
block (i.e., the containing block's height is determined by the <span
class="propinst-height">'height'</span> property, not by content
height).
</li>
<li>A descendant box is <a href="visuren.html#absolute-positioning">positioned
absolutely</a>, partly outside the box. Such boxes are not always
clipped by the overflow property on their ancestors; specifically,
they are not clipped by the overflow of any ancestor between
themselves and their containing block
</li>
<li>A descendant box has <a href="box.html#margin-properties">negative margins</a>, causing it
to be positioned partly outside the box.
</li>
<li>The 'text-indent' property causes an inline box to hang off either the left or right edge of the block box.
</li>
</ul>
<p>Whenever overflow occurs, the <span
class="propinst-overflow">'overflow'</span> property specifies
whether a box is clipped to its padding edge, and if so, whether
a scrolling mechanism is provided to access any clipped out content.
</p>
<h3><a name="overflow">Overflow</a>: the <span
class="propinst-overflow">'overflow'</span> property</h3>
<!-- #include src=properties/overflow.srb -->
<p>
This property specifies whether content of a block container element is
clipped when it overflows the element's box. It affects the clipping
of all of the element's content except any descendant elements (and
their respective content and descendants) whose containing block is the viewport or an ancestor of the element. Values have the following meanings:
</p>
<dl>
<dt><strong>visible</strong></dt>
<dd>This value indicates that content is not clipped, i.e., it
may be rendered outside the block box.
</dd>
<dt><strong>hidden</strong></dt>
<dd>This value indicates that the content is clipped and that no
scrolling user interface should be provided to view the content outside the
clipping region.
</dd>
<dt><strong>scroll</strong></dt>
<dd>This value indicates that the content is clipped and that if the
user agent uses a scrolling mechanism that is visible on the screen
(such as a scroll bar or a panner), that mechanism should be displayed
for a box whether or not any of its content is clipped. This avoids
any problem with scrollbars appearing and disappearing in a dynamic
environment.
When this value is specified and the target medium is
'print', overflowing content may be printed.
</dd>
<dt><strong>auto</strong></dt>
<dd>The behavior of the 'auto' value is user agent-dependent, but
should cause a scrolling mechanism to be provided for overflowing boxes.
</dd>
</dl>
<p> Even if <span class="propinst-overflow">'overflow'</span> is set
to 'visible', content may be clipped to a UA's document window by the
native operating environment.
</p>
<p>
UAs must apply the 'overflow' property set on the root element to
the viewport.
When the root element is an HTML "HTML" element or an XHTML "html"
element, and that element has an HTML "BODY" element or an XHTML
"body" element as a child, user agents must instead apply the
'overflow' property from the first such child element to the
viewport, if the value on the root element is 'visible'.
The 'visible' value when used for the viewport
must be interpreted as 'auto'. The element from which the value is
propagated must have a used value for 'overflow' of 'visible'.
</p>
<p>
In the case of a scrollbar being placed on an edge of the element's
box, it should be inserted between the inner border edge and the outer
padding edge. Any space taken up by the scrollbars should be taken out
of (subtracted from the dimensions of) the containing block formed by
the element with the scrollbars.
</p>
<div class="example"><p>
Consider the following example of a block quotation
(<code><blockquote></code>) that is too big
for its containing block (established by a <code><div></code>). Here is
the source:</p>
<pre class="html-example"><code class="html">
<div>
<blockquote>
<p>I didn't like the play, but then I saw
it under adverse conditions - the curtain was up.</p>
<cite>- Groucho Marx</cite>
</blockquote>
</div>
</code></pre>
<p>Here is the style sheet controlling the sizes and style of the
generated boxes:
</p>
<pre><code class="css">
div { width : 100px; height: 100px;
border: thin solid red;
}
blockquote { width : 125px; height : 100px;
margin-top: 50px; margin-left: 50px;
border: thin dashed black
}
cite { display: block;
text-align : right;
border: none
}
</code></pre>
<p>The initial value of <span
class="propinst-overflow">'overflow'</span> is 'visible', so
the <code><blockquote></code> would be formatted without clipping, something like this:</p>
<div class="figure">
<p><img src="./images/overflow1.png" alt="Rendered overflow"></p>
</div>
<p>Setting <span class="propinst-overflow">'overflow'</span> to
'hidden' for the <code><div></code>, on the other hand, causes the
<code><blockquote></code> to be clipped by the containing
<code><div></code>:
</p>
<div class="figure">
<p><img src="./images/overflow2.png" alt="Clipped overflow"></p>
</div>
<p>A value of 'scroll' would tell UAs that support
a visible scrolling mechanism to display one so that users
could access the clipped content.
</p>
</div>
<div>
<p>
Finally, consider this case where an absolutely positioned element
is mixed with an overflow parent.
</p>
<p>
Style sheet:
</p>
<pre><code class="html">
container { position: relative; border: solid; }
scroller { overflow: scroll; height: 5em; margin: 5em; }
satellite { position: absolute; top: 0; }
body { height: 10em; }
</code></pre>
<p>
Document fragment:
</p>
<pre><code class="xml">
<container>
<scroller>
<satellite/>
<body/>
</scroller>
</container>
</code></pre>
<p>
In this example, the "scroller" element will not scroll the
"satellite" element, because the latter's containing block is outside
the element whose overflow is being clipped and scrolled.
</p>
</div>
<h3><a name="clipping">Clipping</a>: the <span
class="propinst-clip">'clip'</span> property</h3>
<!--
<p>[What about the "lost errata" for clip? See
<a href="http://lists.w3.org/Archives/Member/w3c-css-wg/2001OctDec/0218.html">David</a>
and
<a href="http://lists.w3.org/Archives/Member/w3c-css-wg/2001OctDec/0235.html">Eric</a>.
BB]
-->
<p>A <span class="index-def" title="clipping region"><dfn>clipping
region</dfn></span> defines what portion of an element's
border box
<!--<a
href="conform.html#rendered-content">rendered content</a>-->
is visible. By default, the element is not clipped. However, the clipping region may be explicitly set with the <span class="propinst-clip">'clip'</span> property.
</p>
<!-- #include src=properties/clip.srb -->
<p>The 'clip' property applies only to absolutely positioned elements.
Values have the following meanings:</p>
<dl>
<dt><strong>auto</strong></dt>
<dd>The element does not clip.</dd>
<dt><span class="index-def" title="<shape>::definition of"><a
name="value-def-shape"
class="value-def"><strong><shape></strong></a></span></dt>
<dd>In CSS 2, the only valid <shape> value is:
rect(<span
class="value-inst-top"><top></span>, <span
class="value-inst-right"><right></span>, <span
class="value-inst-bottom"><bottom></span>, <span
class="value-inst-left"><left></span>)
where <span class="value-inst-top"><top></span> and <span
class="value-inst-bottom"><bottom></span> specify offsets from
the top border edge of the box, and <span
class="value-inst-right"><right></span>, and <span
class="value-inst-left"><left></span> specify offsets from the
left border edge of the box. Authors should separate
offset values with commas. User agents must support separation with
commas, but may also support separation without commas (but not a
combination), because a
previous revision of this specification was ambiguous in this respect.
<p><span class="index-def" title="<top>::definition of"><a
name="value-def-top" class="value-def"><top></a></span>, <span
class="index-def" title="<right>::definition of"><a
name="value-def-right" class="value-def"><right></a></span>,
<span class="index-def" title="<bottom>::definition of"><a
name="value-def-bottom" class="value-def"><bottom></a></span>,
and <span class="index-def" title="<left>::definition of"><a
name="value-def-left" class="value-def"><left></a></span> may
either have a <span class="value-inst-length"><length></span>
value or 'auto'. Negative lengths are permitted. The value 'auto'
means that a given edge of the clipping region will be the same as the
edge of the element's generated border box (i.e., 'auto' means the same as '0' for <span class="value-inst-top"><top></span> and <span
class="value-inst-left"><left></span>, the same as the used
value of the height plus the sum of
vertical padding and border widths for <span
class="value-inst-right"><bottom></span>, and the same as the
used value of the width plus the sum of the horizontal padding and
border widths for <span class="value-inst-right"><right></span>,
such that four 'auto' values result in the clipping region being
the same as the element's border box).
</p>
<p>When coordinates are rounded to pixel coordinates, care should be
taken that no pixels remain visible when <left> and
<right> have the same value (or <top> and <bottom>
have the same value), and conversely that no pixels within the
element's border box remain hidden when these values are 'auto'.
</p>
</dd>
</dl>
<p>An element's clipping region clips out any aspect of the element (e.g., content, children, background, borders, text decoration, outline and visible scrolling mechanism — if any) that is outside the clipping region.
Content that has been clipped does not cause overflow.
</p>
<p>The element's ancestors may also clip portions of their content (e.g., via their own <span class="propinst-clip">'clip'</span> property and/or if
their <span class="propinst-overflow">'overflow'</span> property is
not 'visible'); what is rendered is the cumulative intersection.
</p>
<p>If the clipping region exceeds the bounds of the UA's
document window, content may be clipped to that window by the
native operating environment.
</p>
<div class="example"><p>Example:
The following two rules:</p>
<pre><code class="css">p#one { clip: rect(5px, 40px, 45px, 5px); }
p#two { clip: rect(5px, 55px, 45px, 5px); }</code></pre>
<p>and assuming both Ps are 50 by 55 px, will create, respectively,
the rectangular clipping regions delimited
by the dashed lines in the following illustrations:</p>
<div class="figure">
<p><img src="images/clip.png" alt="Two clipping regions"></p>
</div>
</div>
<div class="note"><p> <em><strong>Note.</strong> In CSS 2, all clipping
regions are rectangular. We anticipate future extensions to permit
non-rectangular clipping. Future updates may also reintroduce a
syntax for offsetting shapes from each edge instead of offsetting from
a point.</em></p></div>
<h2><a name="visibility">Visibility</a>: the <span
class="propinst-visibility">'visibility'</span> property</h2>
<!-- #include src=properties/visibility.srb -->
<p>The <span class="propinst-visibility">'visibility'</span> property
specifies whether the boxes generated by an element are
rendered. Invisible boxes still affect layout (set the <span
class="propinst-display">'display'</span> property to 'none' to
suppress box generation altogether). Values have the following
meanings:</p>
<dl>
<dt><strong>visible</strong></dt>
<dd>The generated box is visible.</dd>
<dt><strong>hidden</strong></dt>
<dd>The generated box is invisible (fully transparent, nothing is drawn), but still
affects layout. Furthermore, descendants of the element will
be visible if they have 'visibility: visible'.</dd>
<dt><strong>collapse</strong></dt>
<dd>Please consult the section on
<a href="tables.html#dynamic-effects">dynamic row and column
effects</a> in tables. If used on elements other than rows, row groups, columns, or column groups,
'collapse' has the same meaning as 'hidden'.
</dd>
</dl>
<p>This property may be used in conjunction with scripts to create
dynamic effects.
</p>
<div class="html-example"><p> In the following example, pressing
either form button invokes an author-defined script function that causes
the corresponding box to become visible and the other to be
hidden. Since these boxes have the same size and position, the effect
is that one replaces the other. (The script code is in a hypothetical
script language. It may or may not have any effect in a CSS-capable
UA.)
</p>
<pre><code class="html">
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
<HTML>
<HEAD><TITLE>Dynamic visibility example</TITLE>
<META
http-equiv="Content-Script-Type"
content="application/x-hypothetical-scripting-language">
<STYLE type="text/css">
<!--
#container1 { position: absolute;
top: 2in; left: 2in; width: 2in }
#container2 { position: absolute;
top: 2in; left: 2in; width: 2in;
visibility: hidden; }
-->
</STYLE>
</HEAD>
<BODY>
<P>Choose a suspect:</P>
<DIV id="container1">
<IMG alt="Al Capone"
width="100" height="100"
src="suspect1.png">
<P>Name: Al Capone</P>
<P>Residence: Chicago</P>
</DIV>
<DIV id="container2">
<IMG alt="Lucky Luciano"
width="100" height="100"
src="suspect2.png">
<P>Name: Lucky Luciano</P>
<P>Residence: New York</P>
</DIV>
<FORM method="post"
action="http://www.suspect.org/process-bums">
<P>
<INPUT name="Capone" type="button"
value="Capone"
onclick='show("container1");hide("container2")'>
<INPUT name="Luciano" type="button"
value="Luciano"
onclick='show("container2");hide("container1")'>
</FORM>
</BODY>
</HTML>
</code></pre>
</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:
-->