Skip to content

Commit 536f2da

Browse files
committed
[css-box-4] Apply margin-trim to flex/grid. #3255
1 parent ba9f694 commit 536f2da

File tree

1 file changed

+40
-10
lines changed

1 file changed

+40
-10
lines changed

css-box-4/Overview.bs

+40-10
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ Margins at Container Edges: the 'margin-trim' property {#margin-trim}
357357
Name: margin-trim
358358
Value: none | block | inline | [ block-start || inline-start || block-end || inline-end ]
359359
Initial: none
360-
Applies to: [=block containers=], [=multi-column containers=]
360+
Applies to: [=block containers=], [=multi-column containers=], [=flex containers=], [=grid containers=]
361361
Inherited: no
362362
Percentages: N/A
363363
Computed value: a set of zero to four keywords indicating which sides to trim
@@ -404,6 +404,22 @@ Margins at Container Edges: the 'margin-trim' property {#margin-trim}
404404
[=computed values=] equivalent to ''margin-trim/block'' or ''margin-trim/inline''
405405
will serialize as those keywords.
406406

407+
Adjacency is not sensitive to space governed by box alignment [[!CSS-ALIGN-3]],
408+
and ignores collapsed boxes (see [[css-flexbox-1#visibility-collapse]])
409+
and tracks ([[css-grid-1#auto-repeat]]).
410+
411+
Note: See also the 'margin-break' property,
412+
which applies to the box’s own margins
413+
when they adjoin a <a>fragmentation break</a>
414+
(page break / column break / etc.).
415+
416+
ISSUE: Define how this property affects margins at breaks
417+
if the box establishes a <a>fragmentation context</a>.
418+
See also <a href="https://github.com/w3c/csswg-drafts/issues/3314">Issue 3314</a>.
419+
420+
<h4 id="margin-trim-block">
421+
Trimming Block Container Content</h4>
422+
407423
For [=block containers=] specifically,
408424
'margin-trim' discards:
409425
<ul>
@@ -437,18 +453,32 @@ Margins at Container Edges: the 'margin-trim' property {#margin-trim}
437453
of a [=block formatting context root=].
438454
</ul>
439455

440-
ISSUE: Should this property apply to [=flex containers=] or [=grid containers=]?
441-
442456
ISSUE(3256): Floats definition needs more work.
443457

444-
Note: See also the 'margin-break' property,
445-
which applies to the box’s own margins
446-
when they adjoin a <a>fragmentation break</a>
447-
(page break / column break / etc.).
458+
<h4 id="margin-trim-flex">
459+
Trimming Flex Container Content</h4>
448460

449-
ISSUE: Define how this property affects margins at breaks
450-
if the box establishes a <a>fragmentation context</a>.
451-
See also <a href="https://github.com/w3c/csswg-drafts/issues/3314">Issue 3314</a>.
461+
For [=flex containers=] specifically,
462+
'margin-trim' discards
463+
<ul>
464+
<li>the corresponding margin of each [=flex item=] on the closest [=flex line=]
465+
when trimming an edge parallel to the [=main axis=]
466+
<li>the corresponding margin of the first/last [=flex item=] on each [=flex line=]
467+
when trimming an edge parallel to the [=cross axis=]
468+
</ul>
469+
470+
This process ignores any [=collapsed flex items=].
471+
472+
<h4 id="margin-trim-grid">
473+
Trimming Grid Container Content</h4>
474+
475+
For [=grid containers=] specifically,
476+
'margin-trim' discards
477+
the corresponding margin of each [=grid item=]
478+
in the [=grid track=] adjacent to the relevant [=box edge=].
479+
480+
This process ignores any [=collapsed grid tracks=].
481+
It does not otherwise ignore any empty [=grid tracks=].
452482

453483
Padding {#paddings}
454484
=======

0 commit comments

Comments
 (0)