Skip to content

Commit 20ce80e

Browse files
committed
[css-display-3][editorial] Change 'order' example to show off a better use-case.
1 parent 5779b99 commit 20ce80e

1 file changed

Lines changed: 72 additions & 11 deletions

File tree

css-display-3/Overview.bs

Lines changed: 72 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -992,20 +992,81 @@ Display Order: the 'order' property</h2>
992992
which specifies which ordinal group the item belongs to.
993993

994994
<div class='example'>
995-
The following figure shows a simple tabbed interface, where the tab for the active pane is always first:
996-
997-
<figure><img src="images/flex-order-example.png" alt></figure>
998-
999-
This could be implemented with the following CSS (showing only the relevant code):
995+
Here's an example of a catalog item card
996+
which has a title, a photo, and a description.
997+
Within each entry, the source document content is ordered logically
998+
with the title first, followed by the description and the photo.
999+
This provides a sensible ordering for speech rendering and in non-CSS browsers.
1000+
For a more compelling visual presentation, however,
1001+
'order' is used to pull the image up from later in the content to the top of the card.
10001002

10011003
<pre class="lang-css">
1002-
.tabs {
1003-
display: flex;
1004-
}
1005-
.tabs > .current {
1006-
order: -1; /* Lower than the default of 0 */
1007-
}
1004+
article.sale-item {
1005+
display: flex;
1006+
flex-flow: column;
1007+
}
1008+
article.sale-item > img {
1009+
order: -1; /* Shift image before other content (in visual order) */
1010+
align-self: center;
1011+
}
10081012
</pre>
1013+
1014+
<pre class="lang-markup">
1015+
&lt;article class="sale-item">
1016+
&lt;h1>Computer Starter Kit&lt;/h1>
1017+
&lt;p>This is the best computer money can buy, if you don’t have much money.
1018+
&lt;ul>
1019+
&lt;li>Computer
1020+
&lt;li>Monitor
1021+
&lt;li>Keyboard
1022+
&lt;li>Mouse
1023+
&lt;/ul>
1024+
&lt;img src="images/computer.jpg"
1025+
alt="You get: a white desktop computer with matching peripherals.">
1026+
&lt;/article>
1027+
</pre>
1028+
1029+
<figure>
1030+
<div id="order-example">
1031+
<img src="images/computer.jpg" alt='You get: a white desktop computer with matching keyboard and monitor.'>
1032+
<h1 id=quiet-pubrules-1 style="font-size: 1.4em;">Computer Starter Kit</h1>
1033+
<p>
1034+
This is the best computer money can buy,
1035+
if you don't have much money.
1036+
<ul>
1037+
<li>Computer
1038+
<li>Monitor
1039+
<li>Keyboard
1040+
<li>Mouse
1041+
</ul>
1042+
</div>
1043+
<figcaption>
1044+
An example rendering of the code above.
1045+
</figcaption>
1046+
</figure>
1047+
1048+
<style>
1049+
#order-example {
1050+
display:flex;
1051+
flex-flow: column;
1052+
margin: 0 auto 1em;
1053+
color: black;
1054+
background: white;
1055+
max-width: 250px;
1056+
padding: 0 1rem;
1057+
text-align: left;
1058+
border: thick solid;
1059+
}
1060+
#order-example > h1 {
1061+
color: black;
1062+
}
1063+
#order-example > img {
1064+
order: -1;
1065+
align-self: center;
1066+
max-width: 100%;
1067+
margin-inline: -1em;
1068+
}
1069+
</style>
10091070
</div>
10101071

10111072
[=flex container|Flex=] and [=grid containers=] lay out their contents

0 commit comments

Comments
 (0)