Skip to content

Commit 853d01a

Browse files
author
howcome
committed
adding examples for snap
1 parent 4986e3e commit 853d01a

1 file changed

Lines changed: 76 additions & 28 deletions

File tree

css-gcpm/Overview.src.html

Lines changed: 76 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -84,13 +84,7 @@ <h2 class="no-num no-toc">Status of this document</h2>
8484

8585
<!--end-status-->
8686

87-
<p>This WD contains functionality that the CSS WG finds interesting
88-
and useful. In general, the earlier a feature appears in this draft,
89-
the more stable it is. Significant changes in functionality and syntax
90-
must be expected from <a href="#paged-presentations">paged
91-
presentations</a> and onwards. Also, functionality described in this
92-
module may be moved to other modules. Since the <a href="http://www.w3.org/TR/2010/WD-css3-gcpm-20100608">previous WD</a>, hyphenation has been moved to <a href="http://www.w3.org/TR/2011/WD-css3-text-20110901/#hyphenation">css3-text</a> and the <a href="http://www.w3.org/TR/2010/WD-css3-gcpm-20100608/#the-super-decimal-list-style-type">super-decimal</a> list-style-type value has been moved to <a href="http://www.w3.org/TR/2011/WD-css3-lists-20110524/#super-decimal">css3-lists</a>. <a href="http://www.w3.org/TR/2010/WD-css3-gcpm-20100608/#named-counter-styles">Named counter styles</a> and the <a href="http://www.w3.org/TR/2010/WD-css3-gcpm-20100608/#the-symbols-list-style-type">symbols()</a> list-style-type value should also appear in a future css3-lists WD.
93-
87+
<p>This WD contains functionality that the CSS WG finds interesting and useful. In general, the earlier a feature appears in this draft, the more stable it is. Significant changes in functionality and syntax must be expected from <a href="#paged-presentations">paged presentations</a> and onwards. Also, functionality described in this module may be moved to other modules. Since the <a href="http://www.w3.org/TR/2010/WD-css3-gcpm-20100608">previous WD</a>, hyphenation has been moved to <a href="http://www.w3.org/TR/2011/WD-css3-text-20110901/#hyphenation">css3-text</a> and the <a href="http://www.w3.org/TR/2010/WD-css3-gcpm-20100608/#the-super-decimal-list-style-type">super-decimal</a> list-style-type value has been moved to <a href="http://www.w3.org/TR/2011/WD-css3-lists-20110524/#super-decimal">css3-lists</a>. <a href="http://www.w3.org/TR/2010/WD-css3-gcpm-20100608/#named-counter-styles">Named counter styles</a> and the <a href="http://www.w3.org/TR/2010/WD-css3-gcpm-20100608/#the-symbols-list-style-type">symbols()</a> list-style-type value should also appear in a future css3-lists WD.
9488

9589
<h2 class="no-num no-toc"><a name="contents">Table of contents</a></h2>
9690

@@ -2732,53 +2726,90 @@ <h3>Floating to the top/bottom: top, bottom, snap</h3>
27322726
</div>
27332727

27342728
<div class=example>
2735-
<p>Float figure to top of the natural column, spanning all columns:
2729+
<p>In this example, a figure naturally appears close to a column break. There is not enough space for the figure in the first column, and it is therefore placed in the second column, leaving white space at the bottom of the first column.</p>
2730+
2731+
<img alt="sample rendering" src=23.png>
2732+
2733+
<p>To avoid the white space, the image can be floated to the nearest edge (in the block direction):</p>
2734+
27362735
<pre>
2737-
.figure { float: top; column-span: all }
2736+
.figure { float: snap }
27382737
</pre>
27392738

2740-
<img alt="sample redering" src=15.png>
2739+
<p>In this example, the figure is already at the nearest edge, so it does not move. However, page floats allow subsequent content to be displayed before the page float and the white space can therefore be filled:</p>
27412740

2741+
<img alt="sample rendering" src=7.png>
27422742
</div>
27432743

27442744
<div class=example>
2745-
<p>In this example, tables will snap to the top/bottom if the top/bottom of the border box is closer than '3em' from the top/bottom of the page/column.
2745+
2746+
<p>In this example, two figures naturally appear in the text flow:</p>
2747+
2748+
<img alt="sample rendering" src=20.png>
2749+
2750+
<p>A typographer would typically try to avoid single lines of text above/below figures, which can be achieved with:
27462751

27472752
<pre>
2748-
table { float: snap }
2749-
table { float: snap(3em) }
2750-
table { float: snap(3em, bottom) }
2751-
table { float: snap(3em 2em, bottom) }
2753+
div.figure { float: snap(1.5em) }
27522754
</pre>
2755+
2756+
<p>The length value specifies the reach of the snap function; in this example the second figure is affected, but not the first.
27532757
</div>
27542758

2759+
<div class=example>
27552760

2756-
<p class=issue>Do numeric values, to represent line numbers, make sense, like for orphans/widows?
2761+
<p>In this example, two figures naturally appear in the text flow:</p>
27572762

2763+
<img alt="sample rendering" src=20.png>
27582764

2759-
<h3>Spanning columns</h3>
2765+
<p>To make the figures snap to the nearest edges, this code can be applied:
2766+
2767+
<pre>
2768+
div.figure { float: snap(2.5em) }
2769+
</pre>
2770+
2771+
<p>The resultant rendering is:</p>
2772+
2773+
<img alt="sample rendering" src=22.png>
2774+
2775+
</div>
27602776

2761-
<p>The 'column-span' property is extended with integer values so that elements can span several columns. If the specified integer value is equal to, or larger than the number of columns in the multicol element, the number of columns spanned will be the same as if 'column-span: all' had been specified.
27622777

27632778

27642779
<div class=example>
2765-
<p>Float figure to top of the last column of the multicol element on the current page:
2780+
2781+
<p>Float figure to top of the natural column, spanning all columns:
2782+
27662783
<pre>
2767-
.figure { float: top; float-defer-column: last }
2784+
.figure { float: top; column-span: all }
27682785
</pre>
2769-
<img alt="sample rendering" src=6.png>
2786+
2787+
<img alt="sample redering" src=15.png>
2788+
27702789
</div>
27712790

27722791

27732792
<div class=example>
2774-
<p>In combination with 'column-span', the figure is floated to the top corner of the multicol element on that page:
2793+
<p>In this example, tables will snap to the top/bottom if the top/bottom of the border box is closer than '3em' from the top/bottom of the page/column.
2794+
27752795
<pre>
2776-
.figure { float: top; column-span: 2; float-defer-column: last; width: 100% }
2796+
table { float: snap }
2797+
table { float: snap(3em) }
2798+
table { float: snap(3em, bottom) }
2799+
table { float: snap(3em 2em, bottom) }
27772800
</pre>
2778-
<img alt="sample rendering" src=8.png>
27792801
</div>
27802802

27812803

2804+
<p class=issue>Do numeric values, to represent line numbers, make sense, like for orphans/widows?
2805+
2806+
2807+
<h3>Spanning columns</h3>
2808+
2809+
<p>The 'column-span' property is extended with integer values so that elements can span several columns. If the specified integer value is equal to, or larger than the number of columns in the multicol element, the number of columns spanned will be the same as if 'column-span: all' had been specified.
2810+
2811+
2812+
27822813
<div class=example>
27832814
<p>In this example, a commonly used newspaper layout is easily described:
27842815
<pre>
@@ -2862,7 +2893,10 @@ <h4>'float-defer-page'</h4>
28622893

28632894
<dt>&lt;integer>
28642895

2865-
<dd>A positive integer value indicates that the page float should be displayed in a following column/page.
2896+
<dd>A positive integer value indicates that the page float should be displayed in a following column/page. A negative integer value indicates that the page float should be displayed in a following column/page, counted from the last column/page. When counting columns, the starting point is the last column of the multicol element on the natural page. When counting pages, the starting point is the last page of the multicol element.
2897+
2898+
</dl>
2899+
28662900

28672901
<div class=example>
28682902
<p>Float figure to the top of the column that follows the natural column:
@@ -2873,8 +2907,6 @@ <h4>'float-defer-page'</h4>
28732907
</pre>
28742908
</div>
28752909

2876-
<dd>A negative integer value indicates that the page float should be displayed in a following column/page, counted from the last column/page. When counting columns, the starting point is the last column of the multicol element on the natural page. When counting pages, the starting point is the last page of the multicol element.
2877-
28782910
<div class=example>
28792911
<p>Float figure to the top of the next-to-last column:
28802912

@@ -2884,6 +2916,23 @@ <h4>'float-defer-page'</h4>
28842916
<img alt="sample rendering" src=7.png>
28852917
</div>
28862918

2919+
<div class=example>
2920+
<p>Float figure to top of the last column of the multicol element on the current page:
2921+
<pre>
2922+
.figure { float: top; float-defer-column: last }
2923+
</pre>
2924+
<img alt="sample rendering" src=6.png>
2925+
</div>
2926+
2927+
2928+
<div class=example>
2929+
<p>In combination with 'column-span', the figure is floated to the top corner of the multicol element on that page:
2930+
<pre>
2931+
.figure { float: top; column-span: 2; float-defer-column: last; width: 100% }
2932+
</pre>
2933+
<img alt="sample rendering" src=8.png>
2934+
</div>
2935+
28872936

28882937
<div class=example>
28892938
<p>Float figure to the top of the second column, spanning two columns:
@@ -2972,7 +3021,6 @@ <h4>'float-defer-page'</h4>
29723021
<dt>none
29733022
<dd>The page floats should appear in their natural column/page, if possible.
29743023

2975-
</dl>
29763024

29773025
<p>Zero is not a legal value.
29783026

0 commit comments

Comments
 (0)