Skip to content

Commit dc17272

Browse files
committed
[css-regions] add breaking news example
1 parent 3d21299 commit dc17272

2 files changed

Lines changed: 100 additions & 30 deletions

File tree

css-regions/Overview.html

Lines changed: 53 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -162,10 +162,11 @@ <h2 class="no-num no-toc no-ref heading settled heading" id=contents><span class
162162
<li><a href=#usecases><span class=secno>10</span> Use Cases</a>
163163
<li><a href=#changes><span class=secno>11</span> Changes</a>
164164
<ul class=toc>
165-
<li><a href=#changes_from_May_28_2013><span class=secno>11.1</span> Changes from <span>May 28<sup>th</sup> 2013</span> version</a>
166-
<li><a href=#changes_from_Aug_28_2012><span class=secno>11.2</span> Changes from <span>August 28<sup>th</sup> 2012</span> version</a>
167-
<li><a href=#changes_from_May_03_2012><span class=secno>11.3</span> Changes from <span>May 3<sup>rd</sup> 2012</span> version</a>
168-
<li><a href=#older_changes><span class=secno>11.4</span>Older Changes</a></ul>
165+
<li><a href=#changes_from_Feb_18_2014><span class=secno>11.1</span> Changes from <span>February 18<sup>th</sup> 2014</span> version</a>
166+
<li><a href=#changes_from_May_28_2013><span class=secno>11.2</span> Changes from <span>May 28<sup>th</sup> 2013</span> version</a>
167+
<li><a href=#changes_from_Aug_28_2012><span class=secno>11.3</span> Changes from <span>August 28<sup>th</sup> 2012</span> version</a>
168+
<li><a href=#changes_from_May_03_2012><span class=secno>11.4</span> Changes from <span>May 3<sup>rd</sup> 2012</span> version</a>
169+
<li><a href=#older_changes><span class=secno>11.5</span>Older Changes</a></ul>
169170
<li><a href=#acknowledgments><span class=secno></span> Acknowledgments</a>
170171
<li><a href=#conformance><span class=secno></span> Conformance</a>
171172
<ul class=toc>
@@ -191,8 +192,8 @@ <h2 class="heading settled heading" data-level=1 id=introduction><span class=sec
191192

192193
<p> The core concept behind CSS Regions
193194
is the ability to say,
194-
"Display <em>this</em> content (a named flow)
195-
over <em>there</em> (a region chain)."
195+
"Display <em>this</em> content (a <a class=css data-link-type=maybe href=#named-flow0 title="named flow">named flow</a>)
196+
over <em>there</em> (a <a class=css data-link-type=maybe href=#region-chain0 title="region chain">region chain</a>)."
196197
The simplest example is:
197198

198199
<div class=example>
@@ -211,12 +212,13 @@ <h2 class="heading settled heading" data-level=1 id=introduction><span class=sec
211212
put it into a flow named "my-flow",
212213
and display the contents of "my-flow"
213214
in the box from the element that matches <code>#there</code>.
214-
This example has a single content source for the named flow,
215-
and a single box for the region chain.
215+
This example has a single content source for the <a class=css data-link-type=maybe href=#named-flow0 title="named flow">named flow</a>,
216+
and a single box for the <a class=css data-link-type=maybe href=#region-chain0 title="region chain">region chain</a>.
216217
Named flows can also have multiple sources
217-
and use multiple boxes for the region chain.
218+
and use multiple boxes for the <a class=css data-link-type=maybe href=#region-chain0 title="region chain">region chain</a>.
218219

219-
<p> This building block allows multiple uses -
220+
<p> The <a class=css data-link-type=maybe href=#named-flow0 title="named flow">named flow</a> mechanism can be used
221+
in several different ways -
220222
some of which are
221223
custom overflow handling,
222224
aggregating content,
@@ -265,7 +267,7 @@ <h2 class="heading settled heading" data-level=1 id=introduction><span class=sec
265267
max-height: 80vh;
266268
}
267269
</code></pre>
268-
<p> So the top box in the region chain
270+
<p> So the top box in the <a class=css data-link-type=maybe href=#region-chain0 title="region chain">region chain</a>
269271
is limited to 80% of the viewport height.
270272
If the article content doesn’t fit in that box,
271273
the article will continue
@@ -289,7 +291,7 @@ <h2 class="heading settled heading" data-level=1 id=introduction><span class=sec
289291
the red outline indicates the size of the viewport.
290292

291293
<p>This example links just two boxes together,
292-
but more boxes could be added to the region chain
294+
but more boxes could be added to the <a class=css data-link-type=maybe href=#region-chain0 title="region chain">region chain</a>
293295
to regularly interleave other content with the article.
294296
</div>
295297

@@ -304,7 +306,7 @@ <h2 class="heading settled heading" data-level=1 id=introduction><span class=sec
304306
...some more links...
305307
&lt;/div&gt;
306308
</code></pre>
307-
<p> If the links in the main nav element are placed in a named flow, that flow can be directed through both the main nav element and the overflow nav box in the menu:
309+
<p> If the links in the main nav element are placed in a <a class=css data-link-type=maybe href=#named-flow0 title="named flow">named flow</a>, that flow can be directed through both the main nav element and the overflow nav box in the menu:
308310

309311
<pre><code class=css>
310312
nav a {
@@ -333,7 +335,32 @@ <h2 class="heading settled heading" data-level=1 id=introduction><span class=sec
333335
</div>
334336

335337
<div class=example>
336-
An example of aggregating content can fill a named flow with content from multiple sources.
338+
339+
<p> Since content is assigned to a <a class=css data-link-type=maybe href=#named-flow0 title="named flow">named flow</a> using a CSS selector, the content can come from multiple sources. The resulting aggregation can be displayed in a single box or flowed through multiple boxes as above.
340+
341+
<p> So given this markup:
342+
343+
<pre><code class=html>
344+
&lt;div class="breaking-news"&gt;&lt;/div&gt;
345+
346+
&lt;article&gt;News story&lt;/article&gt;
347+
&lt;article class="breaking"&gt;Sports story&lt;/article&gt;
348+
&lt;article&gt;News story&lt;/article&gt;
349+
&lt;article class="breaking"&gt;Entertainment story&lt;/article&gt;
350+
&lt;article&gt;Sports story&lt;/article&gt;
351+
</code></pre>
352+
<p> You can take the "breaking" stories and display them above all the others using two lines of CSS:
353+
354+
<pre><code class=css>
355+
.breaking {
356+
flow-into: breaking-news;
357+
}
358+
.breaking-news {
359+
flow-from: breaking-news;
360+
}
361+
</code></pre>
362+
<p> Given more data accessible to CSS selectors, you could rearrange the articles in other ways (sports on top, etc.) depending on the user’s preferences.
363+
337364
</div>
338365

339366
<div class=note><span class=note-prefix>Note </span>
@@ -394,7 +421,7 @@ <h3 class="heading settled heading" data-level=2.2 id=region-chain><span class=s
394421
a <a class=css data-link-type=maybe href=#named-flow0 title="named flow">named flow</a>.
395422
<a class=css data-link-type=maybe href=#css-region title="css regions">CSS Regions</a> in a
396423
region chain receive content from the
397-
named flow following their order in the chain.
424+
<a class=css data-link-type=maybe href=#named-flow0 title="named flow">named flow</a> following their order in the chain.
398425
<a class=css data-link-type=maybe href=#css-region title="css regions">CSS Regions</a> are organized
399426
into a <a class=css data-link-type=maybe href=#region-chain0 title="region chain">region chain</a>
400427
according to the document order.
@@ -2153,7 +2180,14 @@ <h2 class="heading settled heading" data-level=10 id=usecases><span class=secno>
21532180
<h2 class="heading settled heading" data-level=11 id=changes><span class=secno>11 </span><span class=content>
21542181
Changes</span><a class=self-link href=#changes></a></h2>
21552182

2156-
<h3 class="heading settled heading" data-level=11.1 id=changes_from_May_28_2013><span class=secno>11.1 </span><span class=content>
2183+
<h3 class="heading settled heading" data-level=11.1 id=changes_from_Feb_18_2014><span class=secno>11.1 </span><span class=content>
2184+
Changes from <a href=http://www.w3.org/TR/2014/WD-css3-regions-20140218/>February 18<sup>th</sup> 2014</a> version</span><a class=self-link href=#changes_from_Feb_18_2014></a></h3>
2185+
2186+
<p> <ul>
2187+
<li>Added three simpler examples to the introduction</li>
2188+
<li>Moved complex example to the <a href=http://wiki.csswg.org/spec/css3-regions/complex-layout-example>CSSWG wiki</a></li>
2189+
</ul>
2190+
<h3 class="heading settled heading" data-level=11.2 id=changes_from_May_28_2013><span class=secno>11.2 </span><span class=content>
21572191
Changes from <a href=http://www.w3.org/TR/2013/WD-css3-regions-20130528/>May 28<sup>th</sup> 2013</a> version</span><a class=self-link href=#changes_from_May_28_2013></a></h3>
21582192

21592193
<p> <ul>
@@ -2169,7 +2203,7 @@ <h3 class="heading settled heading" data-level=11.1 id=changes_from_May_28_2013>
21692203
<li>Changed type of NamedFlow.getContent() from NodeList to sequence&lt;Node&gt;</li>
21702204
</ul>
21712205

2172-
<h3 class="heading settled heading" data-level=11.2 id=changes_from_Aug_28_2012><span class=secno>11.2 </span><span class=content>
2206+
<h3 class="heading settled heading" data-level=11.3 id=changes_from_Aug_28_2012><span class=secno>11.3 </span><span class=content>
21732207
Changes from <a href=http://www.w3.org/TR/2012/WD-css3-regions-20120823/>August 28<sup>th</sup> 2012</a> version</span><a class=self-link href=#changes_from_Aug_28_2012></a></h3>
21742208

21752209
<p> <ul>
@@ -2194,7 +2228,7 @@ <h3 class="heading settled heading" data-level=11.2 id=changes_from_Aug_28_2012>
21942228
<li>Changed region-overflow property to region-fragment.</li>
21952229
</ul>
21962230

2197-
<h3 class="heading settled heading" data-level=11.3 id=changes_from_May_03_2012><span class=secno>11.3 </span><span class=content>
2231+
<h3 class="heading settled heading" data-level=11.4 id=changes_from_May_03_2012><span class=secno>11.4 </span><span class=content>
21982232
Changes from <a href=http://www.w3.org/TR/2012/WD-css3-regions-20120503/>May 3<sup>rd</sup> 2012</a> version</span><a class=self-link href=#changes_from_May_03_2012></a></h3>
21992233

22002234
<p> <ul>
@@ -2209,7 +2243,7 @@ <h3 class="heading settled heading" data-level=11.3 id=changes_from_May_03_2012>
22092243
<li>Changed regionLayoutUpdate to not bubble.</li>
22102244
</ul>
22112245

2212-
<h3 class="heading settled heading" data-level=11.4 id=older_changes><span class=secno>11.4 </span><span class=content>Older Changes</span><a class=self-link href=#older_changes></a></h3>
2246+
<h3 class="heading settled heading" data-level=11.5 id=older_changes><span class=secno>11.5 </span><span class=content>Older Changes</span><a class=self-link href=#older_changes></a></h3>
22132247

22142248
<p> Older changelogs are <a href=http://wiki.csswg.org/spec/css3-regions/older-changelogs>archived</a> on the CSSWG wiki.
22152249

css-regions/Overview.src.html

Lines changed: 47 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ <h2 id="introduction">
2323

2424
The core concept behind CSS Regions
2525
is the ability to say,
26-
"Display <em>this</em> content (a named flow)
27-
over <em>there</em> (a region chain)."
26+
"Display <em>this</em> content (a ''named flow'')
27+
over <em>there</em> (a ''region chain'')."
2828
The simplest example is:
2929

3030
<div class="example">
@@ -44,12 +44,13 @@ <h2 id="introduction">
4444
put it into a flow named "my-flow",
4545
and display the contents of "my-flow"
4646
in the box from the element that matches <code>#there</code>.
47-
This example has a single content source for the named flow,
48-
and a single box for the region chain.
47+
This example has a single content source for the ''named flow'',
48+
and a single box for the ''region chain''.
4949
Named flows can also have multiple sources
50-
and use multiple boxes for the region chain.
50+
and use multiple boxes for the ''region chain''.
5151

52-
This building block allows multiple uses -
52+
The ''named flow'' mechanism can be used
53+
in several different ways -
5354
some of which are
5455
custom overflow handling,
5556
aggregating content,
@@ -101,7 +102,7 @@ <h2 id="introduction">
101102
}
102103
</code></pre>
103104

104-
So the top box in the region chain
105+
So the top box in the ''region chain''
105106
is limited to 80% of the viewport height.
106107
If the article content doesn't fit in that box,
107108
the article will continue
@@ -127,7 +128,7 @@ <h2 id="introduction">
127128
the red outline indicates the size of the viewport.
128129

129130
<p>This example links just two boxes together,
130-
but more boxes could be added to the region chain
131+
but more boxes could be added to the ''region chain''
131132
to regularly interleave other content with the article.
132133
</div>
133134

@@ -143,7 +144,7 @@ <h2 id="introduction">
143144
&lt;/div&gt;
144145
</code></pre>
145146

146-
If the links in the main nav element are placed in a named flow, that flow can be directed through both the main nav element and the overflow nav box in the menu:
147+
If the links in the main nav element are placed in a ''named flow'', that flow can be directed through both the main nav element and the overflow nav box in the menu:
147148

148149
<pre><code class="css">
149150
nav a {
@@ -175,7 +176,34 @@ <h2 id="introduction">
175176
</div>
176177

177178
<div class="example">
178-
An example of aggregating content can fill a named flow with content from multiple sources.
179+
180+
Since content is assigned to a ''named flow'' using a CSS selector, the content can come from multiple sources. The resulting aggregation can be displayed in a single box or flowed through multiple boxes as above.
181+
182+
So given this markup:
183+
184+
<pre><code class="html">
185+
&lt;div class="breaking-news"&gt;&lt;/div&gt;
186+
187+
&lt;article&gt;News story&lt;/article&gt;
188+
&lt;article class="breaking"&gt;Sports story&lt;/article&gt;
189+
&lt;article&gt;News story&lt;/article&gt;
190+
&lt;article class="breaking"&gt;Entertainment story&lt;/article&gt;
191+
&lt;article&gt;Sports story&lt;/article&gt;
192+
</code></pre>
193+
194+
You can take the "breaking" stories and display them above all the others using two lines of CSS:
195+
196+
<pre><code class="css">
197+
.breaking {
198+
flow-into: breaking-news;
199+
}
200+
.breaking-news {
201+
flow-from: breaking-news;
202+
}
203+
</code></pre>
204+
205+
Given more data accessible to CSS selectors, you could rearrange the articles in other ways (sports on top, etc.) depending on the user's preferences.
206+
179207
</div>
180208

181209
<div class="note"><span class="note-prefix">Note </span>
@@ -236,7 +264,7 @@ <h3 id="region-chain">
236264
a ''named flow''.
237265
''CSS Regions'' in a
238266
region chain receive content from the
239-
named flow following their order in the chain.
267+
''named flow'' following their order in the chain.
240268
''CSS Regions'' are organized
241269
into a ''region chain''
242270
according to the document order.
@@ -2084,6 +2112,14 @@ <h2 id="usecases">
20842112
<h2 id="changes">
20852113
Changes</h2>
20862114

2115+
<h3 id="changes_from_Feb_18_2014">
2116+
Changes from <a href="http://www.w3.org/TR/2014/WD-css3-regions-20140218/">February 18<sup>th</sup> 2014</a> version</h3>
2117+
2118+
<ul>
2119+
<li>Added three simpler examples to the introduction</li>
2120+
<li>Moved complex example to the <a href="http://wiki.csswg.org/spec/css3-regions/complex-layout-example">CSSWG wiki</a></li>
2121+
</ul>
2122+
20872123
<h3 id="changes_from_May_28_2013">
20882124
Changes from <a href="http://www.w3.org/TR/2013/WD-css3-regions-20130528/">May 28<sup>th</sup> 2013</a> version</h3>
20892125

0 commit comments

Comments
 (0)