Skip to content

Commit f92c6f3

Browse files
committed
[css-line-grid] adding alignment snapping examples
1 parent 8c4f83d commit f92c6f3

10 files changed

Lines changed: 146 additions & 10 deletions

css-line-grid/Overview.html

Lines changed: 59 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
rel=dcterms.rights>
1313
<meta content="CSS Line Grid Module Level 1" name=dcterms.title>
1414
<meta content=text name=dcterms.type>
15-
<meta content=2014-05-06 name=dcterms.date>
15+
<meta content=2014-07-18 name=dcterms.date>
1616
<meta content="Elika Etemad" name=dcterms.creator>
1717
<meta content="Koji Ishii" name=dcterms.creator>
1818
<meta content="Alan Stearns" name=dcterms.creator>
@@ -51,13 +51,13 @@
5151

5252
<h1>CSS Line Grid Module Level 1</h1>
5353

54-
<h2 class="no-num no-toc">Editor's Draft 6 May 2014</h2>
54+
<h2 class="no-num no-toc">Editor's Draft 18 July 2014</h2>
5555

5656
<dl>
5757
<dt>This version:
5858

5959
<dd><a href="http://dev.w3.org/csswg/css-line-grid-1/">
60-
http://www.w3.org/TR/2014/ED-css-line-grid-1-20140506/</a>
60+
http://www.w3.org/TR/2014/ED-css-line-grid-1-20140718/</a>
6161

6262
<dt>Latest version:
6363

@@ -502,12 +502,12 @@ <h3 id=line-snap><span class=secno>3.1. </span> Snapping Line Boxes: the
502502

503503
<p>This property applies to all the line boxes directly contained by the
504504
element, and, when not ‘<a href="#none0"><code
505-
class=css>none</code></a>’, causes each line box to shift downward
506-
(possibly by zero) until it snaps to the line grid specified by<a
507-
href="#line-grid0"><code class=property>line-grid</code></a>’. (The
508-
unshifted position is the position that would be determined by normal line
509-
stacking rules, with consideration of any new controls defined by other
510-
modules such as <a href="#ref-CSS3LINE"
505+
class=css>none</code></a>’, causes each line box to shift (usually
506+
downward, possibly by zero) until it snaps to the line grid specified by
507+
<a href="#line-grid0"><code class=property>line-grid</code></a>’.
508+
(The unshifted position is the position that would be determined by normal
509+
line stacking rules, with consideration of any new controls defined by
510+
other modules such as <a href="#ref-CSS3LINE"
511511
rel=biblioentry>[CSS3LINE]<!--{{CSS3LINE}}--></a>.) Values have the
512512
following meanings:
513513

@@ -541,6 +541,56 @@ <h3 id=line-snap><span class=secno>3.1. </span> Snapping Line Boxes: the
541541
line box so as to allow the line to snap without jumping downward to the
542542
next grid line.
543543

544+
<div class=example>
545+
<p>When a block is start-aligned, its line boxes will always shift
546+
downward when snapping to a line grid. Here and in the next two examples
547+
there are two lines (A and B) with line-snap:none and two or three lines
548+
(1, 2 and 3) with line-snap:baseline. Here lines 1, 2 and 3 shift down to
549+
snap their baselines to the line grid.
550+
<figure style="float:left;"> <img alt="line positions before snapping"
551+
src="images/top-no-snap.png"> <figcaption> Before snapping </figcaption>
552+
</figure> <figure style="float:left;"> <img
553+
alt="line positions after snapping" src="images/top-snapped.png">
554+
<figcaption> After line snapping </figcaption> </figure></div>
555+
556+
<div class=example>
557+
<p>A center-aligned block's line boxes shift nearly the same as a
558+
start-aligned block's. All the lines except for the very first snapped
559+
line (line 1 in this example) shift exactly the same as a start-aligned
560+
block. Then the block is centered, and the shortest distance from the
561+
first snapped line's baseline to a grid line is measured.
562+
563+
<p> If the closest grid line is in the block-start direction, then the
564+
entire block is shifted up from the block-end edge to snap the first line
565+
to the grid when the block is centered again.
566+
<figure style="float:left;"> <img alt="line positions at step 1"
567+
src="images/first-center-part-snapped.png"> <figcaption> Partial snapping
568+
</figcaption> </figure> <figure style="float:left;"> <img
569+
alt="line positions after full snapping"
570+
src="images/first-center-snapped.png"> <figcaption> Full line snapping
571+
</figcaption> </figure>
572+
<p style="clear:left;">If the closest grid line is in the block-end
573+
direction, then the first snapped line is shifted downward to snap the
574+
first line to the grid when the block is centered again.
575+
<figure style="float:left;"> <img alt="line positions at step 1"
576+
src="images/second-center-part-snapped.png"> <figcaption> Partial snapping
577+
</figcaption> </figure> <figure style="float:left;"> <img
578+
alt="line positions after full snapping"
579+
src="images/second-center-snapped.png"> <figcaption> Full line snapping
580+
</figcaption> </figure></div>
581+
582+
<div class=example>
583+
<p>An end-aligned block shifts snapped lines upward from the block-end
584+
direction. The shifting distance between any two adjacent snapped lines
585+
will be the same as in the other alignment cases. The main difference is
586+
that the shifting between snapped and not-snapped lines (or the block
587+
edge) occurs below the snapped lines.
588+
<figure style="float:left;"> <img alt="line positions before snapping"
589+
src="images/bottom-no-snap.png"> <figcaption> Before snapping
590+
</figcaption> </figure> <figure style="float:left;"> <img
591+
alt="line positions after snapping" src="images/bottom-snapped.png">
592+
<figcaption> After line snapping </figcaption> </figure></div>
593+
544594
<h3 id=box-snap><span class=secno>3.2. </span> Snapping Block Boxes: the
545595
<a href="#box-snap0"><code class=property>box-snap</code></a>
546596
property</h3>

css-line-grid/Overview.src.html

Lines changed: 87 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ <h3 id=line-snap>
336336

337337
<p>This property applies to all the line boxes directly contained by
338338
the element, and, when not ''none'', causes each line box to shift
339-
downward (possibly by zero) until it snaps to the line grid specified
339+
(usually downward, possibly by zero) until it snaps to the line grid specified
340340
by 'line-grid'. (The unshifted position is the position that would be
341341
determined by normal line stacking rules, with consideration of any
342342
new controls defined by other modules such as [[CSS3LINE]].) Values
@@ -365,6 +365,92 @@ <h3 id=line-snap>
365365
shifted up within the line box so as to allow the line to snap without
366366
jumping downward to the next grid line.
367367

368+
<div class="example">
369+
<p>When a block is start-aligned,
370+
its line boxes will always shift downward
371+
when snapping to a line grid.
372+
Here and in the next two examples
373+
there are two lines (A and B) with line-snap:none
374+
and two or three lines (1, 2 and 3) with line-snap:baseline.
375+
Here lines 1, 2 and 3 shift down
376+
to snap their baselines to the line grid.
377+
</p>
378+
<figure style="float:left;">
379+
<img src="images/top-no-snap.png"
380+
alt="line positions before snapping"/>
381+
<figcaption>
382+
Before snapping
383+
</figcaption>
384+
</figure>
385+
<figure style="float:left;">
386+
<img src="images/top-snapped.png"
387+
alt="line positions after snapping"/>
388+
<figcaption>
389+
After line snapping
390+
</figcaption>
391+
</figure>
392+
</div>
393+
394+
<div class="example">
395+
396+
<p>A center-aligned block's line boxes shift nearly the same as a start-aligned block's. All the lines except for the very first snapped line (line 1 in this example) shift exactly the same as a start-aligned block. Then the block is centered, and the shortest distance from the first snapped line's baseline to a grid line is measured.
397+
</p>
398+
<p>
399+
If the closest grid line is in the block-start direction, then the entire block is shifted up from the block-end edge to snap the first line to the grid when the block is centered again.
400+
</p>
401+
<figure style="float:left;">
402+
<img src="images/first-center-part-snapped.png"
403+
alt="line positions at step 1"/>
404+
<figcaption>
405+
Partial snapping
406+
</figcaption>
407+
</figure>
408+
<figure style="float:left;">
409+
<img src="images/first-center-snapped.png"
410+
alt="line positions after full snapping"/>
411+
<figcaption>
412+
Full line snapping
413+
</figcaption>
414+
</figure>
415+
416+
<p style="clear:left;">If the closest grid line is in the block-end direction, then the first snapped line is shifted downward to snap the first line to the grid when the block is centered again.
417+
</p>
418+
<figure style="float:left;">
419+
<img src="images/second-center-part-snapped.png"
420+
alt="line positions at step 1"/>
421+
<figcaption>
422+
Partial snapping
423+
</figcaption>
424+
</figure>
425+
<figure style="float:left;">
426+
<img src="images/second-center-snapped.png"
427+
alt="line positions after full snapping"/>
428+
<figcaption>
429+
Full line snapping
430+
</figcaption>
431+
</figure>
432+
</div>
433+
434+
<div class="example">
435+
436+
<p>An end-aligned block shifts snapped lines upward from the block-end direction. The shifting distance between any two adjacent snapped lines will be the same as in the other alignment cases. The main difference is that the shifting between snapped and not-snapped lines (or the block edge) occurs below the snapped lines.
437+
</p>
438+
<figure style="float:left;">
439+
<img src="images/bottom-no-snap.png"
440+
alt="line positions before snapping"/>
441+
<figcaption>
442+
Before snapping
443+
</figcaption>
444+
</figure>
445+
<figure style="float:left;">
446+
<img src="images/bottom-snapped.png"
447+
alt="line positions after snapping"/>
448+
<figcaption>
449+
After line snapping
450+
</figcaption>
451+
</figure>
452+
</div>
453+
368454
<h3 id=box-snap>
369455
Snapping Block Boxes: the 'box-snap' property</h3>
370456

16.2 KB
Loading
16.1 KB
Loading
16.1 KB
Loading
15.9 KB
Loading
14.8 KB
Loading
14.6 KB
Loading
16.1 KB
Loading
15.7 KB
Loading

0 commit comments

Comments
 (0)