Skip to content

Commit 0ad9ae2

Browse files
committed
[css-break-4] Initial commit, adding 'margin-break'. #253
1 parent 08f7b33 commit 0ad9ae2

5 files changed

Lines changed: 181 additions & 0 deletions

File tree

css-break-4/Overview.bs

Lines changed: 181 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,181 @@
1+
<pre class='metadata'>
2+
Title: CSS Fragmentation Module Level 3
3+
Status: ED
4+
Work Status: Exploring
5+
ED: https://drafts.csswg.org/css-break-4/
6+
Shortname: css-break
7+
Group: csswg
8+
Level: 4
9+
TR: https://www.w3.org/TR/css-break-4/
10+
Editor: Rossen Atanassov, Microsoft, ratan@microsoft.com, w3cid 49885
11+
Editor: Elika J. Etemad / fantasai, Invited Expert, http://fantasai.inkedblade.net/contact, w3cid 35400
12+
Abstract: This module describes the fragmentation model that partitions a flow into pages, columns, or regions.
13+
Abstract: It builds on the Page model module and introduces and defines the fragmentation model.
14+
Abstract: It adds functionality for pagination, breaking variable fragment size and orientation, widows and orphans.
15+
Ignored Terms: background positioning area, region chain, … message topic …, reference box
16+
At Risk: the ''region'' and ''break-after/avoid-region'' values of 'break-*'
17+
</pre>
18+
19+
<h1>CSS Fragmentation Module Level 4 <br> <small>Breaking the Web, one fragment at a time</small></h1>
20+
21+
<h2 id="intro">
22+
Introduction</h2>
23+
24+
<em>This section is not normative.</em>
25+
26+
In paged media
27+
(e.g., paper, transparencies, photo album pages,
28+
pages displayed on computer screens as printed output simulations),
29+
as opposed to <a href="https://www.w3.org/TR/CSS2/media.html#continuous-media-group">continuous media</a>,
30+
the content of the document is split into
31+
one or more discrete display surfaces.
32+
In order to avoid awkward breaks
33+
(such as halfway through a line of text),
34+
the layout engine must be able to shift around content
35+
that would fall across the page break.
36+
This process is called <dfn export>pagination</dfn>.
37+
38+
In CSS, in addition to paged media,
39+
certain layout features such as
40+
<a href="https://www.w3.org/TR/css3-regions/">regions</a> [[CSS3-REGIONS]]
41+
and <a href="https://www.w3.org/TR/css3-multicol/">multi-column layout</a> [[CSS-MULTICOL-1]]
42+
create a similarly fragmented environment.
43+
The generic term for breaking content across containers is <a>fragmentation</a>.
44+
This module explains how content breaks across
45+
<a>fragmentation containers</a> (<a>fragmentainers</a>)
46+
such as pages and columns
47+
and how such breaks can be
48+
<a href="#breaking-controls">controlled by the author</a>.
49+
50+
ISSUE: This is currently a diff spec.
51+
See <a href="https://www.w3.org/TR/css-break-3/">CSS Fragmentation Level 3</a>
52+
for the rest of the specification.
53+
(That text will eventually be folded into this document.)
54+
55+
<h3 id="break-margins">
56+
Adjoining Margins at Breaks: the 'margin-break' property</h3>
57+
58+
<pre class="propdef">
59+
Name: margin-break
60+
Value: auto | keep | discard
61+
Initial: auto
62+
Inherited: no
63+
Applies to: all elements
64+
Computed Value: specified keyword
65+
Animation type: discrete
66+
</pre>
67+
68+
Controls whether the box’s <a>block-axis</a> <a>margins</a>
69+
are discarded or kept at a <a>fragmentation break</a>.
70+
Values have the following meanings:
71+
72+
<dl dfn-for=margin-break dfn-type=value>
73+
<dt><dfn>auto</dfn>
74+
<dd>
75+
When an <em>unforced</em> break occurs before or after the box,
76+
any margins adjoining the break truncate to
77+
the <a>remaining fragmentainer extent</a> before the break,
78+
and are truncated to zero after the break.
79+
When a <em>forced break</em> occurs there,
80+
adjoining margins before the break are truncated,
81+
but margins after the break are preserved.
82+
<a href="#valdef-box-decoration-break-clone">Cloned margins</a>
83+
are always truncated to zero.
84+
85+
Note: When margins collapse
86+
(see <a href="https://www.w3.org/TR/CSS2/box.html#collapsing-margins">CSS2&sect;8.3.1</a>),
87+
the margins of multiple boxes can be adjoining the break.
88+
89+
<dt><dfn>keep</dfn>
90+
<dd>
91+
Margins adjoining a <a>fragmentation break</a>
92+
are not truncated.
93+
94+
<dt><dfn>discard</dfn>
95+
<dd>
96+
Margins adjoining a <a>fragmentation break</a>
97+
are always truncated,
98+
including at the start and end of a <a>fragmentation context</a>.
99+
</dl>
100+
101+
ISSUE: <a href="https://www.antennahouse.com/product/ahf66/ahf-focss6.html">Antenna House also allows a second ''keep'' keyword</a>,
102+
which preserves the margin after the break;
103+
it is otherwise discarded.
104+
Do we want to include this feature?
105+
Also, if only one ''keep'' is specified, does it apply only to the before margin or both sides?
106+
107+
<div class="example">
108+
Consider the following <a>multi-column layout</a> example:
109+
<xmp>
110+
<style>
111+
article { columns: 16ch; border: solid silver; }
112+
h3 { break-before: always; }
113+
</style>
114+
<article>
115+
<p>Here we can compare the effects of <code>margin-break</code>,
116+
before and after forced and unforced breaks.</p>
117+
<p>This paragraph starts after an unforced break.</p>
118+
<h3>This heading is given a forced break before.</h3>
119+
</article>
120+
</xmp>
121+
122+
Here are illustrations of how it might render
123+
with each 'margin-break' value:
124+
125+
<figure>
126+
<img src="images/margin-break-auto.png"
127+
alt="Here the top margin is kept on the first paragraph and the heading
128+
(which starts after a forced break)
129+
but not after the second paragraph
130+
(which starts after an unforced break).
131+
The bottom margins are all discarded
132+
at the bottom of each column.">
133+
<figcaption>''margin-break: auto'' (initial value)</figcaption>
134+
</figure>
135+
136+
<figure>
137+
<img src="images/margin-break-discard.png"
138+
alt="Here the top margins occurring at the top of each column
139+
and the bottom margins occurring at the bottom of each column
140+
are all truncated to zero.">
141+
<figcaption>''margin-break: discard''</figcaption>
142+
</figure>
143+
144+
<figure>
145+
<img src="images/margin-break-keep-discard.png"
146+
alt="Here the top margins occurring at the top of each column
147+
are all kept; however the bottom margins are still truncated.">
148+
<figcaption>''margin-break: keep discard''</figcaption>
149+
</figure>
150+
151+
<figure>
152+
<img src="images/margin-break-keep-keep.png"
153+
alt="Here the top margins occurring at the top of each column
154+
as well as the bottom margins occurng at the bottom of each column
155+
are all kept; this increases the height of the auto-height container
156+
to accommodate the bottom margins.">
157+
<figcaption>''margin-break: keep keep''</figcaption>
158+
</figure>
159+
</div>
160+
161+
<h2 class="no-num" id="changes">
162+
Changes</h2>
163+
164+
<h3 class="no-num" id="changes-level-4">
165+
Changes Since Level 3</h3>
166+
167+
The following features have been added since
168+
<a href="https://www.w3.org/TR/css-break-3/">CSS Fragmentation Level 3</a>:
169+
<ul>
170+
<li>The 'margin-break' property.
171+
</ul>
172+
173+
<h2 class="no-num" id="acknowledgments">
174+
Acknowledgments</h2>
175+
176+
The editors would like to thank
177+
Murakami Shinyu
178+
specifically for his contributions to CSS Fragmentation Level 4,
179+
and to
180+
<a href="https://www.w3.org/TR/css-break-3/#acknowledgments">all the contributors to Level 3</a>,
181+
which constitutes the bulk of this specification.
18.5 KB
Loading
18.4 KB
Loading
18.4 KB
Loading
18.5 KB
Loading

0 commit comments

Comments
 (0)