|
12 | 12 | rel=dcterms.rights> |
13 | 13 | <meta content="CSS Line Grid Module Level 1" name=dcterms.title> |
14 | 14 | <meta content=text name=dcterms.type> |
15 | | - <meta content=2014-07-18 name=dcterms.date> |
| 15 | + <meta content=2014-07-21 name=dcterms.date> |
16 | 16 | <meta content="Elika Etemad" name=dcterms.creator> |
17 | 17 | <meta content="Koji Ishii" name=dcterms.creator> |
18 | 18 | <meta content="Alan Stearns" name=dcterms.creator> |
|
51 | 51 |
|
52 | 52 | <h1>CSS Line Grid Module Level 1</h1> |
53 | 53 |
|
54 | | - <h2 class="no-num no-toc">Editor's Draft 18 July 2014</h2> |
| 54 | + <h2 class="no-num no-toc">Editor's Draft 21 July 2014</h2> |
55 | 55 |
|
56 | 56 | <dl> |
57 | 57 | <dt>This version: |
58 | 58 |
|
59 | 59 | <dd><a href="http://dev.w3.org/csswg/css-line-grid-1/"> |
60 | | - http://www.w3.org/TR/2014/ED-css-line-grid-1-20140718/</a> |
| 60 | + http://www.w3.org/TR/2014/ED-css-line-grid-1-20140721/</a> |
61 | 61 |
|
62 | 62 | <dt>Latest version: |
63 | 63 |
|
@@ -542,38 +542,60 @@ <h3 id=line-snap><span class=secno>3.1. </span> Snapping Line Boxes: the |
542 | 542 | next grid line. |
543 | 543 |
|
544 | 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. |
| 545 | + <p>Line boxes almost always shift downward (towards the block-end |
| 546 | + direction) when snapping to a line grid. Here there are three lines with |
| 547 | + 20px line-height and line-snap:baseline that should snap to a 30px line |
| 548 | + grid. Each line box shifts down so that the baselines align with the grid |
| 549 | + lines. <figure style="float:left;"> <img |
| 550 | + alt="line positions before snapping" src="images/simple-no-snap.png"> |
| 551 | + <figcaption> Before line snapping </figcaption> </figure> <figure |
| 552 | + style="float:left;"> <img alt="line positions after snapping" |
| 553 | + src="images/simple-snapped.png"> <figcaption> After line snapping |
| 554 | + </figcaption> </figure> |
| 555 | + |
| 556 | + <p style="clear:left;"> In the figures below, there are two additional |
| 557 | + lines from h3 elements with line-snap:none. These lines do not shift to |
| 558 | + align to the grid, but their positions can change based on the shifting |
| 559 | + of lines around them. In this example, lines 1 2 and 3 shift down to snap |
| 560 | + their baselines to the grid lines, and line B has normal line box |
| 561 | + placement just below the line above. |
550 | 562 | <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 |
| 563 | + src="images/top-no-snap.png"> <figcaption> Before line snapping |
| 564 | + </figcaption> </figure> <figure style="float:left;"> <img |
553 | 565 | alt="line positions after snapping" src="images/top-snapped.png"> |
554 | 566 | <figcaption> After line snapping </figcaption> </figure></div> |
555 | 567 |
|
556 | 568 | <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. |
| 569 | + <p> The block containing all of these lines might not be top-aligned |
| 570 | + within its container. In the figures below, the block containing the |
| 571 | + elements is centered. In a centered situation, you have to align |
| 572 | + baselines while maintaining centering. |
| 573 | + |
| 574 | + <p> This can be done in two shift-and-center steps. First, shift the |
| 575 | + snapping lines as if there were no centering, then remove the shift for |
| 576 | + the very first snapping line and center the block. You can see the result |
| 577 | + in the partial shifting figure below. Note that the shift for lines 2 and |
| 578 | + 3 are exactly the same as the full line snapping figure in the previous, |
| 579 | + top-aligned example. |
| 580 | + |
| 581 | + <p> In the second step, measure the distance from the first snapped line's |
| 582 | + baseline to the grid lines above and below, looking for the closest grid |
| 583 | + line to that baseline. If the closest grid line is in the block-start |
| 584 | + direction, then add space below the last line equal to twice that |
| 585 | + distance. Then the block is centered again, which will align all of the |
| 586 | + snapped lines to the grid. |
566 | 587 | <figure style="float:left;"> <img alt="line positions at step 1" |
567 | | - src="images/first-center-part-snapped.png"> <figcaption> Partial snapping |
| 588 | + src="images/first-center-part-snapped.png"> <figcaption> Partial shifting |
568 | 589 | </figcaption> </figure> <figure style="float:left;"> <img |
569 | 590 | alt="line positions after full snapping" |
570 | 591 | src="images/first-center-snapped.png"> <figcaption> Full line snapping |
571 | 592 | </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. |
| 593 | + <p style="clear:left;"> If the closest grid line is in the block-end |
| 594 | + direction, then the first snapped line is shifted downward by twice that |
| 595 | + distance. Then the block is centered again, which will again align all of |
| 596 | + the snapped lines to the grid. |
575 | 597 | <figure style="float:left;"> <img alt="line positions at step 1" |
576 | | - src="images/second-center-part-snapped.png"> <figcaption> Partial snapping |
| 598 | + src="images/second-center-part-snapped.png"> <figcaption> Partial shifting |
577 | 599 | </figcaption> </figure> <figure style="float:left;"> <img |
578 | 600 | alt="line positions after full snapping" |
579 | 601 | src="images/second-center-snapped.png"> <figcaption> Full line snapping |
|
0 commit comments