@@ -14,7 +14,8 @@ Status: ED
1414Work Status : exploring
1515Editor : Koji Ishii, Google, kojiishi@gmail.com
1616ED : https://drafts.csswg.org/css-snap-size/
17- Abstract : This module contains CSS features for aligning content size to a multiple of unit size.
17+ Abstract : This module contains CSS features for aligning content size
18+ to multiple of unit size.
1819</pre>
1920<pre class=link-defaults>
2021spec:css21; type:property; text:max-height
@@ -25,31 +26,33 @@ spec:css21; type:property; text:min-width
2526Introduction {#intro}
2627=====================
2728
28- This specification provides features to snap sizes of CSS objects
29+ This specification provides features to control sizes of CSS objects
2930according to the rules desired by use cases.
3031
31- Snapping sizes of CSS objects is desired in many cases.
32+ Controlling sizes of CSS objects to be multiple of a unit
33+ is desired in many cases.
3234This level of the specification focuses on following cases.
3335
34- * Snapping heights of line boxes to the multiple of specified length .
35- * Snapping widths of block-level boxes to the multiple of specified length .
36+ * Adjust heights of line boxes to the multiple of the specified unit .
37+ * Adjust widths of block-level boxes to the multiple of the specified unit .
3638
37- By snapping heights of line boxes,
39+ By controlling heights of line boxes,
3840lines of text in different fonts can create consistent visuals
3941to help readability.
4042
41- Also by stacking such snapped line boxes,
42- authors can create a vertical rhythm by aligning lines across columns,
43- pages, scroll-snapped blocks, or multiple blocks placed absolutely.
43+ Also by stacking such line boxes,
44+ authors can align lines across columns,
45+ pages, scroll-snapped blocks, or multiple blocks placed absolutely,
46+ to produce vertical rhythm.
4447
4548<div class="figure">
4649<a href="examples/snap-height.html">
4750<img src="images/snap-height-sample.png"></a>
4851<p class="caption"> Vertical rhythm kept through pictures and different size of text in a multi-column document.
4952</div>
5053
51- Snapping widths of block-level boxes gives the ability
52- to control the width of a block
54+ Controlling widths of block-level boxes to the multiple of the specified unit
55+ gives the ability to control a block
5356so that it can fit mono-space characters
5457without remainders.
5558One of the use cases this feature addresses is
@@ -58,14 +61,14 @@ In Han ideographic-based scripts such as Chinese or Japanese,
5861most characters have 1em advance,
5962and due to that nature, most such documents are justified.
6063
61- Snapping widths of block-level boxes to the multiple of 1em helps to
64+ Adjusting widths of block-level boxes to the multiple of 1em helps to
6265minimize cases where justification needs to expand spacing.
6366
64- Snapping Heights: the 'snap -height' property {#snap -height}
65- ===========================================================
67+ Adjusting Line Box Heights: the 'line -height-step ' property {#line -height-step }
68+ ===============================================================================
6669
6770<pre class='propdef'>
68- Name : snap -height
71+ Name : line -height-step
6972 Value : <<length>> <<integer>>?
7073 Initial : 0px
7174 Applies to : block containers
@@ -78,25 +81,24 @@ Snapping Heights: the 'snap-height' property {#snap-height}
7881
7982Values have the following meanings:
8083
81- <dl dfn-for="snap -height">
84+ <dl dfn-for="line -height-step ">
8285 <dt> <<length>>
8386 <dd>
84- This value defines the <dfn>snap unit</dfn> .
87+ This value defines the <dfn>step unit</dfn> for line box heights .
8588 Non-negative <<length>> s are valid.
8689 <dt> <<integer>>
8790 <dd>
88- This value defines the <dfn>snap baseline position</dfn>
89- within the <a>snap unit</a> .
91+ This value defines the <dfn>step baseline position</dfn>
92+ within the <a>step unit</a> .
9093 Values between 1 and 100 (inclusive) are valid.
9194</dl>
9295
93- Issue: Renaming proposed to height-factor and width-factor,
94- to be discussed.
96+ Issue: Naming under discussion.
9597
96- Snapping Line Box Heights {#snap-line- height}
97- ---------------------------------------------
98+ Stepping Line Box Heights {#height}
99+ -----------------------------------
98100
99- When the <a>snap unit</a> is set to a positive <<length>> ,
101+ When the <a>step unit</a> is set to a positive <<length>> ,
100102the line box heights are rounded <i> up</i> to
101103the closest multiple of the unit.
102104
@@ -112,16 +114,16 @@ in the line box.
112114 <p class="caption"> Rounding up the computed line box height.
113115</div>
114116
115- The <a>snap baseline position</a> determines
117+ The <a>step baseline position</a> determines
116118how the additional spaces are distributed.
117119
118120* When it is not set,
119121 the space is distributed to
120122 <a>over</a> -side (T) and <a>under</a> -side (B) equally,
121123 so that the original line box appears at the center of the
122- multiple of <a>snap units </a> .
124+ multiple of <a>step unit </a> .
123125* When it is set,
124- refer to the <a href="#snap- baseline">snapping baselines </a> section below.
126+ refer to the <a href="#baseline">baseline </a> section below.
125127
126128<div class="example">
127129 <div class="figure" style="float:right">
@@ -131,14 +133,14 @@ how the additional spaces are distributed.
131133 </div>
132134
133135 In the following example,
134- the height of line box in each paragraph is rounded up to the <a>snap unit</a> .
136+ the height of line box in each paragraph is rounded up to the <a>step unit</a> .
135137
136138 <pre class="lang-css">
137139 :root {
138140 --my-body-font-size: 12pt;
139141 --my-grid: 18pt;
140142 font-size: var(--my-body-font-size);
141- snap -height: var(--my-grid);
143+ line -height-step : var(--my-grid);
142144 }
143145 h1 {
144146 font-size: calc(1.618 * var(--my-body-font-size));
@@ -149,102 +151,102 @@ how the additional spaces are distributed.
149151 }
150152 </pre>
151153
152- The line box in <code> <h1></code> does not fit into one <a>snap unit</a>
154+ The line box in <code> <h1></code> does not fit into one <a>step unit</a>
153155 and thus occupies two,
154- but it is still centered within the two <a>snap unit</a> .
156+ but it is still centered within the two <a>step unit</a> .
155157</div>
156158
157- Snapping Baselines {#snap- baseline}
158- -----------------------------------
159+ Aligning Baselines {#baseline}
160+ ------------------------------
159161
160162<div class="figure" style="float:right">
161163 <img src="images/line-grid-baseline.svg"
162164 >
163165</div>
164166
165- When the <a>snap baseline position</a> is set,
167+ When the <a>step baseline position</a> is set,
166168the additional spaces are distributed using the following formula:
167169
168170* space-over = P - T % U, add U if the result is negative
169171* space-under = U - (space-over + T + B) % U
170172
171173Given:
172174
173- * U: the <a>snap unit</a> .
174- * P: the <a>snap baseline position</a> × U / 100.
175+ * U: the <a>step unit</a> .
176+ * P: the <a>step baseline position</a> × U / 100.
175177* T: the distance between the top of the line box and the baseline.
176178* B: the distance between the bottom of the line box and the baseline.
177179
178180This formula pushes the baseline of the line box
179- down to the closest <a>snap baseline position</a> ,
180- and the bottom to the next <a>snap unit</a> .
181+ down to the closest <a>step baseline position</a> ,
182+ and the bottom to the next <a>step unit</a> .
181183
182184<div class="example">
183185 <div class="figure" style="float:right">
184186 <img src="images/line-grid-baseline-multicol.svg"
185187 >
186188 </div>
187189
188- The following CSS sets the <a>snap baseline position</a>
189- to 14pt (20pt × 0.70) within each <a>snap unit</a> .
190+ The following CSS sets the <a>step baseline position</a>
191+ to 14pt (20pt × 0.70) within each <a>step unit</a> .
190192
191193 <pre class="lang-css">
192194 :root {
193- snap -height: 20pt 70;
195+ line -height-step : 20pt 70;
194196 }
195197 </pre>
196198
197199 The baseline of the line box is pushed down
198- to the closest <a>snap baseline position</a>
200+ to the closest <a>step baseline position</a>
199201 by adding the space-over.
200202
201203 <code> <h1></code> is as tall as
202- its baseline being lower than the second <a>snap baseline position</a>
203- that it is pushed down to the third <a>snap baseline position</a> .
204+ its baseline being lower than the second <a>step baseline position</a>
205+ that it is pushed down to the third <a>step baseline position</a> .
204206</div>
205207
206208<div class="note">
207- Since the bottom of the line box is rounded to the closest <a>snap unit</a>
209+ Since the bottom of the line box is rounded to the closest <a>step unit</a>
208210 next to the descenders of the line box,
209211 large descenders may result in unintended spaces under the line box.
210- Oftentimes changing <a>snap baseline position</a> can control such situations.
212+ Oftentimes changing <a>step baseline position</a> can control such situations.
211213</div>
212214
213- Snapping Block-level Boxes {#snap- block-height}
214- -----------------------------------------------
215+ Notes on Block-level Boxes {#block-height}
216+ ------------------------------------------
215217
216218<i> This section is not normative.</i>
217219
218220This level of the specification does not provide features
219- to snap heights of block-level boxes.
221+ to adjust heights of block-level boxes.
220222
221223<div class="example">
222224 The following CSS turns <code> <h2></code> to inline-blocks.
223225
224226 <pre class="lang-css">
225227 :root {
226- snap -height: 18pt;
228+ line -height-step : 18pt;
227229 }
228230 h2 {
229231 display: inline-block;
230232 width: 100%;
231- snap -height: 0;
233+ line -height-step : 0;
232234 line-height: 1.2;
233235 }
234236 </pre>
235237
236238 When an <code> <h2></code> is long enough to wrap,
237239 text inside the <code> <h2></code> uses ''line-height: 1.2'' , while
238- the height of the <code> <h2></code> block is snapped
240+ the height of the <code> <h2></code> block is rounded up
239241 to the multiple of ''18pt'' .
240- See <a href="examples/snap -height.html">a sample in action</a> .
242+ See <a href="examples/line -height-step .html">a sample in action</a> .
241243</div>
242244
243- Snapping Widths: the 'snap-width ' property {#snap- width}
244- ========================================================
245+ Stepping Widths: the 'inline-size-step ' property {#width}
246+ =========================================================
245247
246248<pre class='propdef'>
247- Name : snap-width
249+ Name : inline-size-step
248250 Value : <<length>>
249251 Initial : 0px
250252 Applies to : all elements but non-replaced inline elements, table rows, and row groups
@@ -264,9 +266,9 @@ to the closest multiple of the specified <<length>>
264266before it is used.
265267
266268<div class="note">
267- Since this property only snaps <a>available inline size</a> ,
269+ Since this property only adjusts <a>available inline size</a> ,
268270it does not guarantee that the <a>inline size</a> of child boxes
269- are snapped to the multiple of the specified <<length>>
271+ are the multiple of the specified <<length>>
270272if there were other constraints.
271273</div>
272274
@@ -281,12 +283,12 @@ if there were other constraints.
281283 but the expansion occurs
282284 only when there are non-CJK characters in the line
283285 because their logical widths are
284- snapped to the multiple of 1em.
286+ adjusted to the multiple of 1em.
285287 <pre class="lang-css">
286288 article, .bodytext {
287289 font-size: 12pt;
288290 text-align: justify;
289- snap-width : 1em;
291+ inline-size-step : 1em;
290292 }
291293 </pre>
292294</div>
0 commit comments