@@ -1031,67 +1031,6 @@ Reordering and Accessibility
1031
1031
(Since visual perception is two-dimensional and non-linear,
1032
1032
the desired visual order is not always logical.)
1033
1033
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
-
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
-
1095
1034
In order to preserve the author's intended ordering in all presentation modes,
1096
1035
authoring tools--
1097
1036
including WYSIWYG editors as well as Web-based authoring aids--
0 commit comments