Skip to content

Commit 22f1109

Browse files
committed
Added example of 'vertical-align' and also compared it with
stretchable margins.
1 parent cc2acff commit 22f1109

1 file changed

Lines changed: 63 additions & 3 deletions

File tree

css3-layout/Overview.src.html

Lines changed: 63 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2477,10 +2477,10 @@ <h2>Rendering of grid elements</h2>
24772477

24782478
<h3 id=vertical-alignment>Vertical alignment of the contents of slots</h3>
24792479

2480-
<p class=issue>Add the effect of 'margin-{top,bottom}: auto',
2481-
generalized from flexbox. (By reference to css3-box?)
2482-
24832480
<div class=issue>
2481+
<p>Add the effect of 'margin-{top,bottom}: auto', generalized from
2482+
flexbox? (By reference to css3-box?)
2483+
24842484
<p>Especially in paged material, it is very common for a column of
24852485
text to be not just aligned or centered, but vertically “justified” to
24862486
align at both top and bottom, by a combination of means: scaling an
@@ -2589,6 +2589,66 @@ <h3 id=vertical-alignment>Vertical alignment of the contents of slots</h3>
25892589
overflow (if the slot is the last in a 'chain') or to remain empty
25902590
(because the first line box is put in the next chained slot instead).
25912591

2592+
<p class=issue>Is there a need to explain that, if there is a
2593+
stretching margin in the contents of the slot (a suggested feature in
2594+
css3-box), there is no visible difference between ''top'' and
2595+
''bottom'' (because the content is stretched to the size of the slot),
2596+
but ''baseline'' still has effect?
2597+
2598+
<div class=example>
2599+
<p>Example: Given a document like this
2600+
2601+
<pre>
2602+
&lt;BODY>
2603+
&lt;P>...&lt;/P>
2604+
&lt;FIGURE>...&lt;/P>
2605+
&lt;P>...&lt;/P>
2606+
&lt;FIGURE>...&lt;/P>
2607+
&lt;P>...&lt;/P>
2608+
&lt;FIGURE>...&lt;/P>
2609+
&lt;P>...&lt;/P>
2610+
&lt;FIGURE>...&lt;/P>
2611+
&lt;/BODY>
2612+
</pre>
2613+
2614+
<p>and a style like this:
2615+
2616+
<pre>
2617+
BODY { grid: "a b" }
2618+
P { flow: a }
2619+
FIGURE { flow: b }
2620+
</pre>
2621+
2622+
<p>the paragraphs will be in the first slot (a) and the figures in the
2623+
second (b). There are two ways to align the contents of the two slots
2624+
to the bottom. One is with 'vertical-align':
2625+
2626+
<pre>BODY::slot(a), BODY::slot(b) { vertical-align: bottom }</pre>
2627+
2628+
<p>The other is with flexible margins:
2629+
2630+
<pre>P:first-of-type, FIGURE:first-of-type { margin-top: fill }</pre>
2631+
</div>
2632+
2633+
<div class=example>
2634+
<p>Example: There is no value for 'vertical-align' to distribute
2635+
elements vertically over the available space (similar to how
2636+
'text-align: justify' distributes words over the available space). But
2637+
the effect can be achieved with stretchable margins. Assume the same
2638+
document as in the previous example and this style sheet:
2639+
2640+
<pre>
2641+
BODY { grid: "a b" }
2642+
P { flow: a; margin-top: fill; margin-bottom: fill }
2643+
FIGURE { flow: b }
2644+
</pre>
2645+
2646+
<p>Because there are stretchable margins between the Ps, the Ps will
2647+
be equally distributed over the height of the slot (assuming the slot
2648+
is taller than its contents, i.e., assuming the contents of slot b is
2649+
taller than the contents of slot a).
2650+
</div>
2651+
25922652
<!--=================================================================-->
25932653

25942654
<h3 id=paged>Breaking grid elements across pages or columns</h3>

0 commit comments

Comments
 (0)