Skip to content

Commit d123218

Browse files
committed
Draft of flexbox as of 2007-10-05, from Neil Deakin.
1 parent e3a663d commit d123218

2 files changed

Lines changed: 149 additions & 35 deletions

File tree

css3-flexbox/Overview.html

Lines changed: 75 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ <h2 class="no-num no-toc" id="table"><a name="contents">Table of
5656

5757
</li><li><a href="#multiple"><span class="secno">7. </span>Multiple lines</a>
5858

59-
</li><li><a href="#inlinesAndBlocks"><span class="secno">8. </span>Inlines and
59+
</li><li><a href="#inlinesAndBlocks"><span class="secno">8. </span>Relationship to Inlines and
6060
blocks</a>
6161

6262
</li><li><a href="#acknowledgments">Acknowledgments</a>
@@ -136,7 +136,8 @@ <h2 id="overview"><span class="secno">1. </span>Overview</h2>
136136
The <span class="property">'float'</span> and
137137
<span class="property">'clear'</span> properties do not apply to
138138
children of box elements, so the used value for these properties
139-
is 'none'.
139+
is 'none'. These properties do apply to the box itself if it is
140+
not a child of another box.
140141
</p><p>
141142

142143
For example:
@@ -180,7 +181,7 @@ <h2 id="orientation"><span class="secno">2. </span>Orientation</h2>
180181
</span>
181182
<dd>
182183
<table class="propinfo" cellspacing=0 cellpadding=0>
183-
<tr valign=baseline><td><em>Value:</em>&nbsp;&nbsp;<td>horizontal | vertical | inline-axis | block-axis
184+
<tr valign=baseline><td><em>Value:</em>&nbsp;&nbsp;<td>horizontal | vertical | inline-axis | block-axis | <span class="default">inherit</span>
184185
<tr valign=baseline><td><em>Initial:</em>&nbsp;&nbsp;<td>inline-axis
185186
<tr valign=baseline><td><em>Applies to:</em>&nbsp;&nbsp;<td>box elements
186187
<tr valign=baseline><td><em>Inherited:</em>&nbsp;&nbsp;<td>yes
@@ -216,9 +217,9 @@ <h2 id="orientation"><span class="secno">2. </span>Orientation</h2>
216217
<p>
217218
The inline and block axes are the writing-mode dependent keywords which,
218219
in English, map to horizontal and vertical respectively.
219-
The orientation within nested boxes is inherited by default. If the orientation
220-
is omitted on the outermost box in a box group, it is assumed to have a value
221-
of 'inline-axis'.
220+
When the orientation is omitted and the box is directly contained within another
221+
box, the default orientation is inherited from the parent. If the box is not
222+
contained within another box, the orientation is 'inline-axis'.
222223
</p>
223224

224225
<h2 id="displayorder"><span class="secno">3. </span>Display order</h2>
@@ -238,7 +239,7 @@ <h2 id="displayorder"><span class="secno">3. </span>Display order</h2>
238239
</span>
239240
<dd>
240241
<table class="propinfo" cellspacing=0 cellpadding=0>
241-
<tr valign=baseline><td><em>Value:</em>&nbsp;&nbsp;<td>normal | reverse
242+
<tr valign=baseline><td><em>Value:</em>&nbsp;&nbsp;<td>normal | reverse | <span class="default">inherit</span>
242243
<tr valign=baseline><td><em>Initial:</em>&nbsp;&nbsp;<td>normal
243244
<tr valign=baseline><td><em>Applies to:</em>&nbsp;&nbsp;<td>box elements
244245
<tr valign=baseline><td><em>Inherited:</em>&nbsp;&nbsp;<td>yes
@@ -266,9 +267,9 @@ <h2 id="displayorder"><span class="secno">3. </span>Display order</h2>
266267
its children from bottom to top.
267268
</dd></dl>
268269

269-
</p><p>The direction within nested boxes is inherited by default. If the direction
270-
is omitted on the outermost box in a box group, it is assumed to have normal
271-
direction.
270+
</p><p>When the direction is omitted and the box is directly contained within another
271+
box, the default direction is inherited from the parent. If the box is not
272+
contained within another box, the direction is 'normal'.
272273

273274
</p><p>
274275
If the computed value for the box's 'direction' property is 'normal', a
@@ -432,7 +433,7 @@ <h2 id="boxsizing"><span class="secno">4. </span>Box sizing</h2>
432433
</span>
433434
<dd>
434435
<table class="propinfo" cellspacing=0 cellpadding=0>
435-
<tr valign=baseline><td><em>Value:</em>&nbsp;&nbsp;<td>start | end | center | baseline | stretch
436+
<tr valign=baseline><td><em>Value:</em>&nbsp;&nbsp;<td>start | end | center | baseline | <span class="default">stretch</span>
436437
<tr valign=baseline><td><em>Initial:</em>&nbsp;&nbsp;<td>stretch
437438
<tr valign=baseline><td><em>Applies to:</em>&nbsp;&nbsp;<td>box elements
438439
<tr valign=baseline><td><em>Inherited:</em>&nbsp;&nbsp;<td>no
@@ -585,7 +586,7 @@ <h2 id="boxsizing"><span class="secno">4. </span>Box sizing</h2>
585586
<table class="propinfo" cellspacing=0 cellpadding=0>
586587
<tr valign=baseline><td><em>Value:</em>&nbsp;&nbsp;<td>&lt;number&gt;
587588
<tr valign=baseline><td><em>Initial:</em>&nbsp;&nbsp;<td>0.0
588-
<tr valign=baseline><td><em>Applies to:</em>&nbsp;&nbsp;<td>children of box elements
589+
<tr valign=baseline><td><em>Applies to:</em>&nbsp;&nbsp;<td>in-flow children of box elements
589590
<tr valign=baseline><td><em>Inherited:</em>&nbsp;&nbsp;<td>no
590591
<tr valign=baseline><td><em>Percentages:</em>&nbsp;&nbsp;<td>no
591592
<tr valign=baseline><td><em>Media:</em>&nbsp;&nbsp;<td>visual</a>
@@ -603,7 +604,7 @@ <h2 id="boxsizing"><span class="secno">4. </span>Box sizing</h2>
603604
<table class="propinfo" cellspacing=0 cellpadding=0>
604605
<tr valign=baseline><td><em>Value:</em>&nbsp;&nbsp;<td>&lt;integer&gt;
605606
<tr valign=baseline><td><em>Initial:</em>&nbsp;&nbsp;<td>1
606-
<tr valign=baseline><td><em>Applies to:</em>&nbsp;&nbsp;<td>children of box elements
607+
<tr valign=baseline><td><em>Applies to:</em>&nbsp;&nbsp;<td>in-flow children of box elements
607608
<tr valign=baseline><td><em>Inherited:</em>&nbsp;&nbsp;<td>no
608609
<tr valign=baseline><td><em>Percentages:</em>&nbsp;&nbsp;<td>no
609610
<tr valign=baseline><td><em>Media:</em>&nbsp;&nbsp;<td>visual</a>
@@ -638,6 +639,13 @@ <h2 id="boxsizing"><span class="secno">4. </span>Box sizing</h2>
638639
containing block, then the flexible children shrink as much as necessary to prevent
639640
overflow.
640641

642+
</p><p>
643+
Flexibility only applies to elements in normal flow. As absolute and fixed positioned
644+
elements are not in flow, any flexibility or flexgroup specified on them is ignored.
645+
In addition, as the <span class="property">'float'</span> property does not apply to
646+
children of flexible boxes, they are considered part of normal flow and flexibility
647+
does apply.
648+
641649
</p><p>
642650
When dividing up extra space, first take all elements within the first flex group.
643651
Each element within that group should be given extra width based on the ratio of
@@ -800,7 +808,7 @@ <h2 id="packing"><span class="secno">6. </span>Packing along the box axis</h2>
800808
</span>
801809
<dd>
802810
<table class="propinfo" cellspacing=0 cellpadding=0>
803-
<tr valign=baseline><td><em>Value:</em>&nbsp;&nbsp;<td>start | end | center | justify
811+
<tr valign=baseline><td><em>Value:</em>&nbsp;&nbsp;<td><span class="default">start</span> | end | center | justify
804812
<tr valign=baseline><td><em>Initial:</em>&nbsp;&nbsp;<td>start
805813
<tr valign=baseline><td><em>Applies to:</em>&nbsp;&nbsp;<td>box elements
806814
<tr valign=baseline><td><em>Inherited:</em>&nbsp;&nbsp;<td>no
@@ -870,7 +878,7 @@ <h2 id="packing"><span class="secno">6. </span>Packing along the box axis</h2>
870878
</span>
871879
<dd>
872880
<table class="propinfo" cellspacing=0 cellpadding=0>
873-
<tr valign=baseline><td><em>Value:</em>&nbsp;&nbsp;<td>single | multiple
881+
<tr valign=baseline><td><em>Value:</em>&nbsp;&nbsp;<td><span class="default">single</span> | multiple
874882
<tr valign=baseline><td><em>Initial:</em>&nbsp;&nbsp;<td>single
875883
<tr valign=baseline><td><em>Applies to:</em>&nbsp;&nbsp;<td>box elements
876884
<tr valign=baseline><td><em>Inherited:</em>&nbsp;&nbsp;<td>no
@@ -1019,45 +1027,77 @@ <h2 id="packing"><span class="secno">6. </span>Packing along the box axis</h2>
10191027
within each line are stretched to the size of the largest item in that line.
10201028
</p>
10211029

1022-
<h2 id="inlinesAndBlocks"><span class="secno">8. </span>Inlines and blocks</h2>
1030+
<h2 id="inlinesAndBlocks"><span class="secno">8. </span>Relationship to Inlines and blocks</h2>
10231031

10241032
<p>
1025-
A box placed in a block will be positioned and sized as if it had a display of
1026-
'block' and the width and height of the box is determined in the same manner.
1027-
Specifically, the following equation applies for calculating the width:
1033+
A box placed in a block is considered a block level element and will be positioned
1034+
and sized according to the rules for CSS 2.1 (section 10.3 for widths). Specifically,
1035+
the following equation applies for calculating the width:
10281036
</p>
10291037
<blockquote>
1030-
<p>'margin-left' + 'border-left-width' + 'padding-left' + 'width of box' + 'padding-right' + 'border-right-width' + 'margin-right' = width of containing block
1038+
<p>'margin-left' + 'border-left-width' + 'padding-left' + 'width' + 'padding-right' + 'border-right-width' + 'margin-right' + scrollbar width (if any) = width of containing block
10311039
</p>
10321040
</blockquote>
1041+
<p>All children of 'box' elements are block-level. If inline-level elements are nested
1042+
inside boxes, they get wrapped in an anonymous block which then takes part in the
1043+
box layout.
1044+
1045+
</p><p>
1046+
If the width of a child of a flexible box is computed as 'auto', then the used value
1047+
is the shrink-to-fit width. This calculation is done similarly to how the width of
1048+
a floating element is determined. Otherwise if the width has a computed value,
1049+
then that value is used as the width.
1050+
</p><p>
1051+
1052+
In a horizontally oriented box, the flexibility is then applied which may increase
1053+
or decrease the used width. In a vertically oriented box, the position and size
1054+
of the child may be adjusted by the value of the container's
1055+
<a href="#propdef-box-align">'box-align'</a></span> property.
1056+
</p><p>
1057+
1058+
The <span class="property">'min-width'</span>, <span class="property">'min-height'</span>,
1059+
<span class="property">'max-width'</span>, and <span class="property">'max-height'</span>
1060+
CSS properties act the same on boxes as on blocks.
1061+
</p><p>
1062+
1063+
The height of a child of a flexible box is determined in the same manner as specified
1064+
in the CSS specification. The used height may further be adjusted by the container's
1065+
<a href="#propdef-box-align">'box-align'</a></span> property in a horizontally
1066+
oriented box, or the flexibiliy in a vertically oriented box.
1067+
</p><p>
10331068

1034-
<p>As with 'block' elements, all children of 'box' elements are
1035-
block-level. If inline-level elements are nested inside boxes, they get
1036-
wrapped in an anonymous block which then takes part in the box layout.
1069+
Note that it is possible for a horizontally oriented box that the height of a
1070+
flexible child containing an inline descendant will change when the flexibility is
1071+
applied. Similarly, in a vertically oriented box, the height of a child may change
1072+
based on the <a href="#propdef-box-align">'box-align'</a></span> property of the
1073+
box.
1074+
1075+
</p>
10371076

1038-
</p><p>Boxes size the blocks inside them in much the same way as blocks. In
1039-
particular, <span class="css">width: auto</span> means that the box will
1040-
fill the box's containing block. Similarly, the <span class="property">'min-width'</span>,
1041-
<span class="property">'min-height'</span>, <span class="property">'max-width'</span>, and
1042-
<span class="property">'max-height'</span> CSS properties act the same on boxes
1043-
as on blocks.
1077+
<p class="note">
1078+
Note: more details are needed here, and the relationship with other CSS constructs is
1079+
yet to be defined.
10441080
</p>
1045-
1081+
10461082
<!--<h2 id="inlinesAndBlocks"><span class="secno">9. </span>Initial Containing Blocks</h2>
10471083
10481084
<p>
1049-
A user agent that supports flexible boxes may have a viewport the size of which is
1085+
A user agent that supports flexible boxes may have a viewport where the size is
10501086
computed from the content contained within it. Even if the viewport size is not
10511087
known, it may be constrained by other physical constraints, such as the size of the
10521088
screen, which may be used as the size of the viewport instead.
10531089
10541090
</p><p>
10551091
When the size of the viewport is not known, the size of the initial containing block
10561092
will not be known beforehand. In this situation, this size will be computed from
1057-
the contents within the block. Any percentage sizes used within a block with no
1058-
size for its containing block have a value of 0, although this size may
1059-
grow due to flexibility.
1060-
</p>
1093+
the contents within the block. Both the width and height of the initial containing
1094+
block are considered to be 0 when computing a value that depends on the size of the
1095+
initial containing block. Specifically, this means that a percentage size of
1096+
the initial containing block will be calculated as 0.
1097+
1098+
</p><p>
1099+
Once the document has been laid out, the size of the viewport can be determined from
1100+
the content, and that size may later be used when the document needs to be reflowed.
10611101
-->
10621102

10631103
<hr title="Separator from footer">

css3-flexbox/flexbox.css

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
body {
2+
padding: 2em 1em 2em 70px;
3+
margin: 0;
4+
font-family: sans-serif;
5+
color: black;
6+
background: white;
7+
background-position: top left;
8+
background-attachment: fixed;
9+
background-repeat: no-repeat;
10+
}
11+
:link { color: #00C; background: transparent }
12+
:visited { color: #609; background: transparent }
13+
a:active { color: #C00; background: transparent }
14+
15+
a:link img, a:visited img { border-style: none } /* no border on img links */
16+
17+
a img { color: white; } /* trick to hide the border in Netscape 4 */
18+
@media all { /* hide the next rule from Netscape 4 */
19+
a img { color: inherit; } /* undo the color change above */
20+
}
21+
22+
th, td { /* ns 4 */
23+
font-family: sans-serif;
24+
}
25+
26+
h1, h2, h3, h4, h5, h6 { text-align: left }
27+
/* background should be transparent, but WebTV has a bug */
28+
h1, h2, h3 { color: #005A9C; background: white }
29+
h1 { font: 170% sans-serif }
30+
h2 { font: 140% sans-serif }
31+
h3 { font: 120% sans-serif }
32+
h4 { font: bold 100% sans-serif }
33+
h5 { font: italic 100% sans-serif }
34+
h6 { font: small-caps 100% sans-serif }
35+
36+
.hide { display: none }
37+
38+
div.head { margin-bottom: 1em }
39+
div.head h1 { margin-top: 2em; clear: both }
40+
div.head table { margin-left: 2em; margin-top: 2em }
41+
42+
p.copyright { font-size: small }
43+
p.copyright small { font-size: small }
44+
45+
@media screen { /* hide from IE3 */
46+
a[href]:hover { background: #ffa }
47+
}
48+
49+
.default { text-decoration: underline }
50+
51+
pre { margin-left: 2em }
52+
dt, dd { margin-top: 0; margin-bottom: 0 } /* opera 3.50 */
53+
dt { font-weight: bold }
54+
55+
pre, code { font-family: monospace } /* navigator 4 requires this */
56+
57+
ul.toc, ol.toc {
58+
list-style: disc; /* Mac NS has problem with 'none' */
59+
list-style: none;
60+
}
61+
62+
.propdef-title {
63+
background-color: yellow;
64+
color: black;
65+
}
66+
67+
.example {
68+
color: maroon;
69+
}
70+
71+
.note {
72+
color: green;
73+
}
74+

0 commit comments

Comments
 (0)