3535
3636 < h1 > CSS Grid Template Layout Module</ h1 >
3737 <!--=================================================================-->
38- < h2 class ="no-num no-toc " id =longstatus-date-3-august-2004 > Editor's Draft
39- 16 May 2012</ h2 >
38+ < h2 class ="no-num no-toc " id =editors-draft-17-may-2012 > Editor's Draft 17
39+ May 2012</ h2 >
4040
4141 < dl >
4242 < dt > This version:
4343
4444 < dd > < a
45- href ="http://www.w3.org/TR/2012/ED-css3-layout-20120516 / "> http://www.w3.org/TR/2012/ED-css3-layout-20120516 /</ a >
45+ href ="http://www.w3.org/TR/2012/ED-css3-layout-20120517 / "> http://www.w3.org/TR/2012/ED-css3-layout-20120517 /</ a >
4646
4747
4848 < dt > Latest version:
@@ -113,7 +113,7 @@ <h2 class="no-num no-toc" id=abstract>Abstract</h2>
113113 arbitrary slots so that the visual order becomes independent of the
114114 document order.
115115
116- < p > The < a href ="#slot -pseudo-element. "> ‘< code
116+ < p > The < a href ="#lsquoslotrsquo -pseudo-element. "> ‘< code
117117 class =css > ::slot()</ code > ’ pseudo-element</ a > allows to style the slots
118118 (backgrounds, borders, etc.)
119119
@@ -421,11 +421,10 @@ <h3 id=summary-and-examples><span class=secno>1.1. </span>Summary and
421421 < p > The properties in this specification work by associating a layout grid
422422 with an element. Rather than letting an element lay out its descendants in
423423 a single flow, the policy defined in this module gives an element a
424- < span > grid template,</ span > which is a set of < a href ="#slot "> slots</ a >
425- aligned to an invisible grid, where each slot is a separate flow. The
426- descendants are given a ‘< a href ="#flow0 "> < code
427- class =property > flow</ code > </ a > ’ property to designate the slot into
428- which they flow.
424+ < span > grid template,</ span > which is a set of < span > slots</ span > aligned
425+ to an invisible grid, where each slot is a separate flow. The descendants
426+ are given a ‘< a href ="#flow0 "> < code class =property > flow</ code > </ a > ’
427+ property to designate the slot into which they flow.
429428
430429 < p > Because layouts on the Web have to adapt to different window and paper
431430 sizes, the rows and columns of the grid can be made fixed or flexible in
@@ -814,6 +813,35 @@ <h3 id=summary-and-examples><span class=secno>1.1. </span>Summary and
814813 rel =biblioentry > [CSS3GCPM]<!--{{CSS3GCPM}}--> </ a > for some ideas), or we
815814 could allow a scrollbar on slot c.
816815 </ div >
816+
817+ < div class =example >
818+ < p > This example shows two [three] ways to align the contents of a
819+ fixed-height paragraph to the bottom of the box:
820+
821+ < dl >
822+ < dt > Method 1
823+
824+ < dd >
825+ < pre > P {height: 20em; grid: "." "*" fit-content}</ pre >
826+
827+ < dt > Method 2
828+
829+ < dd >
830+ < pre > P {height: 20em; grid: "*"}
831+ P::slot(*) {vertical-align: bottom}</ pre >
832+
833+ < dt > [Method 3]
834+
835+ < dd class =issue >
836+ < pre > P {height: 20em; vertical-align: bottom}</ pre >
837+ </ dl >
838+
839+ < p > However, the styles differ in case the content is taller than 20 em
840+ and overflows: the first style has a baseline-aligned content which will
841+ thus overflow < em > below</ em > the element's box; the second example has
842+ bottom-aligned content, which will thus overflow < em > above</ em > the
843+ element's box.
844+ </ div >
817845 <!--=================================================================-->
818846
819847 < h3 id =dependencies > < span class =secno > 1.2. </ span > Dependencies on other
@@ -1382,7 +1410,7 @@ <h3 id=grid-row-sizes><span class=secno>2.3. </span>Specifying the height
13821410< dfn id =ltrow-heightgt > <row-height></ dfn > = < a
13831411 href ="#ltlengthgt "> < var > <length></ var > </ a > | < var > <percentage></ var > | * | < var > <fraction></ var > |
13841412 < a
1385- href ="#ltminmaxgt0 "> < var > <minmax></ var > </ a > | min-content | max-content | auto
1413+ href ="#ltminmaxgt0 "> < var > <minmax></ var > </ a > | min-content | max-content | fit-content
13861414< dfn
13871415 id =ltminmaxgt0 > <minmax></ dfn > = minmax( < a
13881416 href ="#ltrow-heightgt "> < var > <row-height></ var > </ a > , < a
@@ -1446,7 +1474,7 @@ <h3 id=grid-row-sizes><span class=secno>2.3. </span>Specifying the height
14461474 class =css > minmax(< var > p</ var > ,< var > q</ var > )</ code > ’ is treated as
14471475 ‘< code class =css > minmax(< var > p</ var > ,< var > p</ var > )</ code > ’.
14481476
1449- < dt > auto
1477+ < dt > fit-content
14501478
14511479 < dd > Equivalent to ‘< code class =css > minmax(min-content,
14521480 max-content)</ code > ’.
@@ -1673,9 +1701,9 @@ <h3 id=slot-sizes><span class=secno>2.6. </span>Calculating the size of the
16731701 class =property > margin-left</ code > </ a > ’, ‘< a
16741702 href ="#margin-right "> < code class =property > margin-right</ code > </ a > ’,
16751703 etc., that is set on it by means of the < a
1676- href ="#slot -pseudo-element. "> ‘< code class = css > ::slot() </ code > ’
1677- pseudo-element</ a > ). Any ‘< code class = css > auto </ code > ’ margins are
1678- counted as 0 in this case.
1704+ href ="#lsquoslotrsquo -pseudo-element. "> ‘< code
1705+ class = css > ::slot() </ code > ’ pseudo-element</ a > ). Any ‘< code
1706+ class = css > auto </ code > ’ margins are counted as 0 in this case.
16791707
16801708 < li > Otherwise, if the slot spans at least one column whose width is
16811709 specified as ‘< code class =css > max-content</ code > ’ (or ‘< code
@@ -2108,11 +2136,11 @@ <h2 id=positioning><span class=secno>3. </span>Putting content into a grid
21082136 root (“establishes a block formatting context” in the terminology of
21092137 CSS level 2), very much like a table cell.
21102138
2111- < p > The second way is to absolutely position elements using four < a
2112- href =" #grid-line " > < em > grid lines</ em > </ a > to specify the positions of the
2113- four margin edges of the element. Like other positioned elements < a
2114- href =" #CSS21 " rel =biblioentry > [CSS21]<!--{{!CSS21}}--> </ a > , these elements
2115- can overlap each other and the ‘< a href ="#z-index "> < code
2139+ < p > The second way is to absolutely position elements using four < em > grid
2140+ lines</ em > to specify the positions of the four margin edges of the
2141+ element. Like other positioned elements < a href =" #CSS21 "
2142+ rel =biblioentry > [CSS21]<!--{{!CSS21}}--> </ a > , these elements can overlap
2143+ each other and the ‘< a href ="#z-index "> < code
21162144 class =property > z-index</ code > </ a > ’ property applies to them.
21172145 <!--=================================================================-->
21182146
@@ -2894,8 +2922,9 @@ <h2 id=slot-pseudo><span class=secno>4. </span>Styling slots: the ‘<a
28942922 href ="#slot "> < code class =css > ::slot()</ code > </ a > ’ pseudo-element</ h2 >
28952923
28962924 < p > The slots of a < a href ="#grid-element. "> < em > grid element</ em > </ a > can be
2897- individually addressed with the < dfn id =slot-pseudo-element. > ‘< code
2898- class =css > slot()</ code > ’ pseudo-element.</ dfn >
2925+ individually addressed with the < dfn
2926+ id =lsquoslotrsquo-pseudo-element. > ‘< code class =css > slot()</ code > ’
2927+ pseudo-element.</ dfn >
28992928
29002929 < div class =example >
29012930 < p > For example, the following sets the background and vertical alignment
@@ -2987,9 +3016,42 @@ <h2 id=region-based><span class=secno>5. </span>Styling the contents of
29873016 class =css > ::first-line</ code > ’ selects the part of an element that is
29883017 on the first line).
29893018
2990- < p > Inherited properties…
3019+ < div class =example >
3020+ < p > For example, this selector selects (the part of) a P that has been
3021+ flowed into a slot called c:
3022+
3023+ < pre > P::flow(b) { color: yellow }</ pre >
3024+ </ div >
3025+
3026+ < p > Only the following properties apply to the ‘< a href ="#flow0 "> < code
3027+ class =css > flow()</ code > </ a > ’ pseudo-element:… [not display, position,
3028+ flow, float]
3029+
3030+ < p > Inherited properties… [inherit from the document tree, not from the
3031+ pseudo-element]
29913032
29923033 < p > Non-inherited properties…
3034+
3035+ < div class =issue >
3036+ < p > The css3-regions draft proposes a different notation, with an at-rule
3037+ for styling (the parts of) elements that are inside the pseudo-element
3038+ of another element:
3039+
3040+ < pre > @region BODY::slot(c) { P { color: yellow } }
3041+ @region P::first-line { EM { font-weight: normal } }</ pre >
3042+
3043+ < p > Another possibility is to allow selectors to have parts after the
3044+ pseudo-element:
3045+
3046+ < pre > BODY::slot(c) P { color: yellow }
3047+ P::first-line EM { font-weight: normal }</ pre >
3048+
3049+ < p > Yet another possibility is a generic ‘< code
3050+ class =css > region()</ code > ’ pseudo-element:
3051+
3052+ < pre > P::region(BODY::slot(c)) { color: yellow }
3053+ EM::region(P::first-line) { font-weight: normal }</ pre >
3054+ </ div >
29933055 </ div >
29943056 <!--=================================================================-->
29953057
@@ -3218,9 +3280,9 @@ <h3 id=vertical-alignment><span class=secno>6.1. </span>Vertical alignment
32183280 < h3 id =paged > < span class =secno > 6.2. </ span > Breaking grid elements across
32193281 pages or columns</ h3 >
32203282
3221- < p > < a href =" #grid-element. " > Grid elements</ a > may be broken across pages,
3222- columns or similar regions (including chained slots of another grid
3223- element), subject to the ‘< a href ="#break-before0 "> < code
3283+ < p > < span > Grid elements</ span > may be broken across pages, columns or
3284+ similar regions (including chained slots of another grid element), subject
3285+ to the ‘< a href ="#break-before0 "> < code
32243286 class =property > break-before</ code > </ a > ’, ‘< a
32253287 href ="#break-after0 "> < code class =property > break-after</ code > </ a > ’ and
32263288 ‘< a href ="#break-inside0 "> < code
@@ -4545,11 +4607,11 @@ <h4 id=use-the-pseudo-class-to-create-additiona><span class=secno>10.2.17.
45454607 < pre > DIV::slot(z) {position: absolute; grid-position: 2 / 2}</ pre >
45464608
45474609 < p > Like other ‘< a href ="#slot "> < code class =css > ::slot()</ code > </ a > ’
4548- pseudo-elements, it applies to < a href =" #grid-element. " > grid elements</ a >
4549- only (the DIV in this example must be a grid element), but unlike other
4550- ‘ < a href ="#slot "> < code class =css > ::slot()</ code > </ a > ’ pseudo-elements
4551- it doesn't style an existing slot, but implicitly creates a new one. (It
4552- is some kind of error if the name ‘< code class =css > z</ code > ’ already
4610+ pseudo-elements, it applies to < span > grid elements</ span > only (the DIV in
4611+ this example must be a grid element), but unlike other ‘ < a
4612+ href ="#slot "> < code class =css > ::slot()</ code > </ a > ’ pseudo-elements it
4613+ doesn't style an existing slot, but implicitly creates a new one. (It is
4614+ some kind of error if the name ‘< code class =css > z</ code > ’ already
45534615 exists in the grid template.)
45544616
45554617 < p > Then you can flow other elements into this slot:
@@ -4678,10 +4740,7 @@ <h4 id=fit-content-vs-auto-vshellip><span class=secno>10.2.21.
46784740 class =css > min-content</ code > ’), ‘< code
46794741 class =css > max-content</ code > ’)).
46804742
4681- < p > In this specification, ‘< code class =css > auto</ code > ’ (not ‘< code
4682- class =css > fit-content</ code > ’) is allowed for column and row sizes and
4683- has the meaning of ‘< code class =css > minmax(min-content,
4684- max-content)</ code > ’.
4743+ < p > An alternative name could be ‘< code class =css > auto</ code > ’.
46854744 <!--=================================================================-->
46864745
46874746 < h4 id =vert-align > < span class =secno > 10.2.22. </ span > Vertical alignment
@@ -5184,6 +5243,26 @@ <h2 class=no-num id=index>Index</h2>
51845243 <!--begin-index-->
51855244
51865245 < ul class =indexlist >
5246+ < li > ‘< code class =css > slot()</ code > ’ pseudo-element., < a
5247+ href ="#lsquoslotrsquo-pseudo-element. "
5248+ title ="‘slot()’ pseudo-element. "> < strong > 4.</ strong > </ a >
5249+
5250+ < li > <col-width>, < a href ="#ltcol-widthgt "
5251+ title ="<col-width> "> < strong > 2.2.</ strong > </ a >
5252+
5253+ < li > < var > <length></ var > , < a href ="#ltlengthgt "
5254+ title ="<length> "> < strong > 1.2.</ strong > </ a >
5255+
5256+ < li > <minmax>, < a href ="#ltminmaxgt "
5257+ title ="<minmax> "> < strong > 2.2.</ strong > </ a > , < a href ="#ltminmaxgt0 "
5258+ title ="<minmax> "> < strong > 2.3.</ strong > </ a >
5259+
5260+ < li > <row-height>, < a href ="#ltrow-heightgt "
5261+ title ="<row-height> "> < strong > 2.3.</ strong > </ a >
5262+
5263+ < li > < var > <string></ var > , < a href ="#ltstringgt "
5264+ title ="<string> "> < strong > 1.2.</ strong > </ a >
5265+
51875266 < li > A edge, < a href ="#a-edge " title ="A edge "> < strong > 6.1.</ strong > </ a >
51885267
51895268 < li > anonymous block of a slot, < a href ="#anonymous-block "
@@ -5232,9 +5311,6 @@ <h2 class=no-num id=index>Index</h2>
52325311
52335312 < li > columns, < a href ="#columns " title =columns > < strong > 1.2.</ strong > </ a >
52345313
5235- < li > <col-width>, < a href ="#ltcol-widthgt "
5236- title ="<col-width> "> < strong > 2.2.</ strong > </ a >
5237-
52385314 < li > containing block, < a href ="#containing-block "
52395315 title ="containing block "> < strong > 3.1.</ strong > </ a >
52405316
@@ -5263,15 +5339,15 @@ <h2 class=no-num id=index>Index</h2>
52635339 < li > grid ancestor, < a href ="#grid-ancestor "
52645340 title ="grid ancestor "> < strong > 2.</ strong > </ a >
52655341
5266- < li > grid-columns, < a href ="#grid-columns "
5267- title =grid-columns > < strong > 2.2.</ strong > </ a >
5268-
52695342 < li > grid element., < a href ="#grid-element. "
52705343 title ="grid element. "> < strong > 2.</ strong > </ a >
52715344
52725345 < li > grid line,, < a href ="#grid-line "
52735346 title ="grid line, "> < strong > 3.2.</ strong > </ a >
52745347
5348+ < li > grid-columns, < a href ="#grid-columns "
5349+ title =grid-columns > < strong > 2.2.</ strong > </ a >
5350+
52755351 < li > grid-position, < a href ="#grid-position0 "
52765352 title =grid-position > < strong > 3.3.</ strong > </ a >
52775353
@@ -5306,9 +5382,6 @@ <h2 class=no-num id=index>Index</h2>
53065382
53075383 < li > left, < a href ="#left " title =left > < strong > 1.2.</ strong > </ a >
53085384
5309- < li > < a href ="#ltlengthgt "> < var > <length></ var > </ a > , < a
5310- href ="#ltlengthgt " title ="<length> "> < strong > 1.2.</ strong > </ a >
5311-
53125385 < li > margin, < a href ="#margin " title =margin > < strong > 1.2.</ strong > </ a >
53135386
53145387 < li > margin-left, < a href ="#margin-left "
@@ -5317,10 +5390,6 @@ <h2 class=no-num id=index>Index</h2>
53175390 < li > margin-right, < a href ="#margin-right "
53185391 title =margin-right > < strong > 1.2.</ strong > </ a >
53195392
5320- < li > <minmax>, < a href ="#ltminmaxgt "
5321- title ="<minmax> "> < strong > 2.2.</ strong > </ a > , < a href ="#ltminmaxgt0 "
5322- title ="<minmax> "> < strong > 2.3.</ strong > </ a >
5323-
53245393 < li > non-interactive, < a href ="#non-interactive "
53255394 title =non-interactive > < strong > 1.2.</ strong > </ a >
53265395
@@ -5344,32 +5413,22 @@ <h2 class=no-num id=index>Index</h2>
53445413
53455414 < li > right, < a href ="#right " title =right > < strong > 1.2.</ strong > </ a >
53465415
5347- < li > <row-height>, < a href ="#ltrow-heightgt "
5348- title ="<row-height> "> < strong > 2.3.</ strong > </ a >
5349-
53505416 < li > slot, < a href ="#slot " title =slot > < strong > 2.1.</ strong > </ a >
53515417
5352- < li > ‘< a href ="#slot "> < code class =css > slot()</ code > </ a > ’
5353- pseudo-element., < a href ="#slot-pseudo-element. "
5354- title ="''slot()'' pseudo-element. "> < strong > 4.</ strong > </ a >
5355-
5356- < li > < a href ="#ltstringgt "> < var > <string></ var > </ a > , < a
5357- href ="#ltstringgt " title ="<string> "> < strong > 1.2.</ strong > </ a >
5358-
53595418 < li > top, < a href ="#top " title =top > < strong > 1.2.</ strong > </ a >
53605419
53615420 < li > vertical, < a href ="#vertical-element "
53625421 title =vertical > < strong > 1.2.</ strong > </ a >
53635422
5364- < li > vertical-align, < a href ="#vertical-align "
5365- title =vertical-align > < strong > 1.2.</ strong > </ a >
5366-
53675423 < li > vertical element, < a href ="#vertical-element "
53685424 title ="vertical element "> < strong > 1.2.</ strong > </ a >
53695425
53705426 < li > vertical writing mode, < a href ="#vertical-writing-mode "
53715427 title ="vertical writing mode "> < strong > 1.2.</ strong > </ a >
53725428
5429+ < li > vertical-align, < a href ="#vertical-align "
5430+ title =vertical-align > < strong > 1.2.</ strong > </ a >
5431+
53735432 < li > width, < a href ="#width " title =width > < strong > 1.2.</ strong > </ a >
53745433
53755434 < li > writing-mode, < a href ="#writing-mode "
0 commit comments