Skip to content

Commit 16d1492

Browse files
committed
[css-flexbox-3] Move flexbox example back to flexbox. #5865
1 parent 2ccbf7b commit 16d1492

File tree

1 file changed

+0
-61
lines changed

1 file changed

+0
-61
lines changed

css-display-3/Overview.bs

Lines changed: 0 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1031,67 +1031,6 @@ Reordering and Accessibility
10311031
(Since visual perception is two-dimensional and non-linear,
10321032
the desired visual order is not always logical.)
10331033

1034-
1035-
Many web pages have a similar shape in the markup,
1036-
with a header on top,
1037-
a footer on bottom,
1038-
and then a content area and one or two additional columns in the middle.
1039-
Generally,
1040-
it's desirable that the content come first in the page's source code,
1041-
before the additional columns.
1042-
However, this makes many common designs,
1043-
such as simply having the additional columns on the left and the content area on the right,
1044-
difficult to achieve.
1045-
This has been addressed in many ways over the years,
1046-
often going by the name "Holy Grail Layout" when there are two additional columns.
1047-
'order' makes this trivial.
1048-
For example, take the following sketch of a page's code and desired layout:
1049-
1050-
1051-
1052-
1053-
<!DOCTYPE html>
1054-
<header>...</header>
1055-
<main>
1056-
<article>...</article>
1057-
<nav>...</nav>
1058-
<aside>...</aside>
1059-
</main>
1060-
<footer>...</footer>
1061-
1062-
1063-
In this page the header is at the top and the footer at the bottom, but the article is in the center, flanked by the nav on the right and the aside on the left.
1064-
1065-
1066-
This layout can be easily achieved with flex layout:
1067-
1068-
1069-
main { display: flex; }
1070-
main > article { order: 2; min-width: 12em; flex:1; }
1071-
main > nav { order: 1; width: 200px; }
1072-
main > aside { order: 3; width: 200px; }
1073-
1074-
1075-
As an added bonus,
1076-
the columns will all be equal-height by default,
1077-
and the main content will be as wide as necessary to fill the screen.
1078-
Additionally,
1079-
this can then be combined with media queries to switch to an all-vertical layout on narrow screens:
1080-
1081-
1082-
@media all and (max-width: 600px) {
1083-
/* Too narrow to support three columns */
1084-
main { flex-flow: column; }
1085-
main > article, main > nav, main > aside {
1086-
/* Return them to document order */
1087-
order: 0; width: auto;
1088-
}
1089-
}
1090-
1091-
1092-
(Further use of multi-line flex containers to achieve even more intelligent wrapping left as an exercise for the reader.)
1093-
1094-
10951034
In order to preserve the author's intended ordering in all presentation modes,
10961035
authoring tools--
10971036
including WYSIWYG editors as well as Web-based authoring aids--

0 commit comments

Comments
 (0)