Skip to content

Commit db68ee4

Browse files
committed
[css-grid-1][css-flexbox-1] Commit changes to require percent margin/padding resolution against inline-axis, per WG discussion. #2085
1 parent 6d06218 commit db68ee4

File tree

2 files changed

+29
-30
lines changed

2 files changed

+29
-30
lines changed

css-flexbox-1/Overview.bs

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -716,20 +716,12 @@ Flex Item Margins and Paddings</h3>
716716
The margins of adjacent <a>flex items</a> do not
717717
<a href="https://www.w3.org/TR/CSS2/box.html#collapsing-margins">collapse</a>.
718718

719-
Percentage margins and paddings on <a>flex items</a> can be resolved against either:
720-
721-
* their own axis (left/right percentages resolve against width, top/bottom resolve against height), or,
722-
* the inline axis (left/right/top/bottom percentages all resolve against width)
723-
724-
A User Agent must choose one of these two behaviors.
725-
726-
Note: This variance sucks, but it accurately captures the current state of the world
727-
(no consensus among implementations, and no consensus within the CSSWG).
728-
It is the CSSWG's intention that browsers will converge on one of the behaviors,
729-
at which time the spec will be amended to require that.
730-
731-
Advisement: Authors should avoid using percentages in paddings or margins on <a>flex items</a> entirely,
732-
as they will get different behavior in different browsers.
719+
Percentage margins and paddings on <a>flex items</a>,
720+
like those on <a>block boxes</a>,
721+
are resolved against the <a>inline size</a> of their <a>containing block</a>,
722+
e.g. left/right/top/bottom percentages
723+
all resolve against their <a>containing block</a>’s <em>width</em>
724+
in horizontal <a>writing modes</a>.
733725

734726
Auto margins expand to absorb extra space in the corresponding dimension.
735727
They can be used for alignment,
@@ -3461,6 +3453,12 @@ Boris Zbarsky.
34613453
Changes since the 16 October 2017 CR</h3>
34623454

34633455
<ul>
3456+
<li id="change-2017-margin-padding-percent">
3457+
Removed the option for flex-item block-axis margins and paddings
3458+
to be resolved against the block dimension;
3459+
they must be resolved against the inline dimension, as for blocks.
3460+
(<a href="https://github.com/w3c/csswg-drafts/issues/2085">Issue 2085</a>)
3461+
34643462
<li id="change-2017-content-desc">
34653463
Added some (effectively informative) prose and a cross-reference
34663464
to more clearly define ''flex-basis: content''.
@@ -3477,7 +3475,6 @@ Changes since the 16 October 2017 CR</h3>
34773475
</blockquote>
34783476
</ul>
34793477

3480-
34813478
<h3 id="changes-20160526">
34823479
Changes since the 26 May 2016 CR</h3>
34833480

css-grid-1/Overview.bs

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1158,24 +1158,15 @@ Grid Item Margins and Paddings</h3>
11581158
the margins of adjacent <a>grid items</a> do not
11591159
<a href="https://www.w3.org/TR/CSS2/box.html#collapsing-margins">collapse</a>.
11601160

1161-
Percentage margins and paddings on <a>grid items</a> can be resolved against either:
1162-
1163-
* their own axis (left/right percentages resolve against width, top/bottom resolve against height), or,
1164-
* the inline axis (left/right/top/bottom percentages all resolve against width)
1165-
1166-
A User Agent must choose one of these two behaviors.
1167-
1168-
Note: This variance sucks, but it accurately captures the current state of the world
1169-
(no consensus among implementations, and no consensus within the CSSWG).
1170-
It is the CSSWG's intention that browsers will converge on one of the behaviors,
1171-
at which time the spec will be amended to require that.
1172-
1173-
Advisement: Authors should avoid using percentages in paddings or margins on <a>grid items</a> entirely,
1174-
as they will get different behavior in different browsers.
1161+
Percentage margins and paddings on <a>grid items</a>,
1162+
like those on <a>block boxes</a>,
1163+
are resolved against the <a>inline size</a> of their <a>containing block</a>,
1164+
e.g. left/right/top/bottom percentages
1165+
all resolve against their <a>containing block</a>’s <em>width</em>
1166+
in horizontal <a>writing modes</a>.
11751167

11761168
Auto margins expand to absorb extra space in the corresponding dimension,
11771169
and can therefore be used for alignment.
1178-
11791170
See [[#auto-margins]]
11801171

11811172
<h3 id='z-order'>
@@ -4256,6 +4247,17 @@ Changes</h2>
42564247
<h3 id="changes-2017">
42574248
Changes since the <a href="https://www.w3.org/TR/2017/CR-css-grid-1-20171215/">15 December 2017 CR</a></h3>
42584249

4250+
<h4 id="major-2017">
4251+
Major Changes</h4>
4252+
4253+
<ul>
4254+
<li id="change-2017-margin-padding-percent">
4255+
Removed the option for grid-item block-axis margins and paddings
4256+
to be resolved against the block dimension;
4257+
they must be resolved against the inline dimension, as for blocks.
4258+
(<a href="https://github.com/w3c/csswg-drafts/issues/2085">Issue 2085</a>)
4259+
</ul>
4260+
42594261
<h4 id="clarify-2017">
42604262
Clarifications</h4>
42614263

0 commit comments

Comments
 (0)