Skip to content

Commit 15b7221

Browse files
committed
[css-transform] Define "containing block for all descendants"
Add a new definition "containing block for all descendants" and specify that values other than 'none' on 'transform', 'transform-style', 'perspective' will cause an element to establish a containg block for all descendants.
1 parent 0a75778 commit 15b7221

File tree

2 files changed

+44
-7
lines changed

2 files changed

+44
-7
lines changed

css-transforms-1/Overview.bs

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,9 +226,46 @@ For elements whose layout is governed by the CSS box model, the transform proper
226226

227227
For elements whose layout is governed by the CSS box model, any value other than ''transform/none'' for the transform results in the creation of a stacking context. Implementations must paint the layer it creates, within its parent stacking context, at the same stacking order that would be used if it were a positioned element with ‘z-index: 0’. If an element with a transform is positioned, the ‘z-index’ property applies as described in [[!CSS2]], except that ‘auto’ is treated as ‘0’ since a new stacking context is always created
228228

229-
For elements whose layout is governed by the CSS box model, any value other than ''transform/none'' for the transform also causes the element to become a containing block, and the object acts as a containing block for fixed positioned descendants.
229+
For elements whose layout is governed by the CSS box model, any value other than ''transform/none'' for the transform also causes the element's padding box to form a containing block for all of its out-of-flow descendants, including both absolute-position and fixed-position descendants, and fixed background attachments on descendants and itself.
230230

231-
Issue(913): Is this effect on ''position: fixed'' necessary? If so, need to go into more detail here about why fixed positioned objects should do this, i.e., that it's much harder to implement otherwise.
231+
<div class="example">
232+
An element with 'transform' other than ''transform/none'' establishes <dfn export>containing block for all descendants</dfn>. To demostrate the effect on fixed-position descendants, the following code snippets should behave identically:
233+
<pre>
234+
&lt;style>
235+
#container {
236+
width: 300px;
237+
height: 200px;
238+
border: 5px dashed black;
239+
padding: 5px;
240+
overflow: scroll;
241+
}
242+
243+
#bloat {
244+
height: 1000px;
245+
}
246+
247+
#child {
248+
right: 0;
249+
bottom: 0;
250+
width: 10%;
251+
height: 10%;
252+
background: green;
253+
}
254+
&lt;/style>
255+
256+
&lt;div id="container" style="transform:translateX(5px);">
257+
&lt;div id="bloat">&lt;/div>
258+
&lt;div id="child" style="position:fixed;">&lt;/div>
259+
&lt;/div>
260+
</pre>
261+
versus
262+
<pre>
263+
&lt;div id="container" style="position:relative; z-index:0; left:5px;">
264+
&lt;div id="bloat">&lt;/div>
265+
&lt;div id="child" style="position:absolute;">&lt;/div>
266+
&lt;/div>
267+
</pre>
268+
</div>
232269

233270
<a href="https://www.w3.org/TR/css3-background/#fixed0">Fixed backgrounds</a> on the root element are affected by any transform specified for that element. For all other elements that are effected by a transform (i.e. have a transform applied to them, or to any of their ancestor elements), a value of ''fixed'' for the 'background-attachment' property is treated as if it had a value of ''background-attachment/scroll''. The computed value of 'background-attachment' is not affected.
234271

css-transforms-2/Overview.bs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ Module Interactions {#module-interactions}
6161

6262
The <a>3D transform functions</a> here extend the set of functions for the 'transform' property.
6363

64-
Some values of 'perspective', 'transform-style' and 'backface-visibility' result in the creation of a <a href="https://www.w3.org/TR/CSS2/visuren.html#containing-block">containing block</a>, and/or the creation of a <a spec="css21">stacking context</a>.
64+
Some values of 'perspective' and 'transform-style' result in the creation of a [=containing block for all descendants=], and/or the creation of a <a spec="css21">stacking context</a>.
6565

6666
Three-dimensional transforms affect the visual layering of elements, and thus override the back-to-front painting order described in <a href="https://www.w3.org/TR/CSS2/zindex.html">Appendix E</a> of [[!CSS21]].
6767

@@ -596,10 +596,10 @@ All three properties accept
596596
the value <dfn value for="translate, rotate, scale">none</dfn>,
597597
which produces no transform at all.
598598
In particular,
599-
this value does <em>not</em> trigger the creation of a stacking context or containing block,
599+
this value does <em>not</em> trigger the creation of a stacking context or [=containing block for all descendants=],
600600
while all other values
601601
(including identity transforms like ''translate: 0px'')
602-
create a stacking context and containing block,
602+
create a stacking context and [=containing block for all descendants=],
603603
per usual for transforms.
604604

605605
When 'translate', 'rotate' or 'scale' are animating or transitioning, and the from value or to
@@ -638,7 +638,7 @@ Media: visual
638638
Animatable: no
639639
</pre>
640640

641-
A value of "flat" for 'transform-style' establishes a stacking context, and establishes a <a>3D rendering context</a>. Elements with a used value of "auto" are ignored for the purposes of 3D rendering context computation, and those with a used value of "preserve-3d" extend the 3D rendering context to which they belong, even if values for the ''transform'' or ''perspective'' properties would otherwise cause flattening. A value of "preserve-3d" establishes a stacking context, and a containing block.
641+
A value of "flat" for 'transform-style' establishes a stacking context, and establishes a <a>3D rendering context</a>. Elements with a used value of "auto" are ignored for the purposes of 3D rendering context computation, and those with a used value of "preserve-3d" extend the 3D rendering context to which they belong, even if values for the ''transform'' or ''perspective'' properties would otherwise cause flattening. A value of "preserve-3d" establishes a stacking context, and a [=containing block for all descendants=].
642642

643643
Grouping property values {#grouping-property-values}
644644
------------------------
@@ -694,7 +694,7 @@ Where <<length>> values must be positive.
694694

695695
</dl>
696696

697-
The use of this property with any value other than ''perspective/none'' establishes a stacking context. It also establishes a containing block (somewhat similar to ''position: relative''), just like the 'transform' property does.
697+
The use of this property with any value other than ''perspective/none'' establishes a stacking context. It also establishes a [=containing block for all descendants=], just like the 'transform' property does.
698698

699699
The values of the 'perspective' and 'perspective-origin' properties are used to compute the <a>perspective matrix</a>, as described above.
700700

0 commit comments

Comments
 (0)