Skip to content

Commit 7745694

Browse files
committed
[css2] Generated. Do not edit!
--HG-- extra : convert_revision : svn%3A73dc7c4b-06e6-40f3-b4f7-9ed1dbc14bfc/trunk%403095
1 parent eaede31 commit 7745694

5 files changed

Lines changed: 157 additions & 116 deletions

File tree

css2/box.html

Lines changed: 127 additions & 106 deletions
Original file line numberDiff line numberDiff line change
@@ -358,117 +358,138 @@ <H2>8.3 <a name="margin-properties">Margin properties</a>:
358358

359359
<H3>8.3.1 <a name="collapsing-margins">Collapsing margins</a></H3>
360360

361-
<P>In this specification, the expression <a name="x26"><span class="index-def"
362-
title="collapsing margin"><dfn>collapsing margins</dfn></span></a> means
363-
that adjoining margins (no non-empty content, padding or border areas
364-
or <a href="visuren.html#clearance">clearance</a> separate them) of
365-
two or more boxes (which may be next to one another or nested) combine
366-
to form a single margin.
361+
<P>In CSS, the adjoining margins of two or more boxes (which might or
362+
might not be siblings) can combine to form a single margin. Margins
363+
that combine this way are said to <dfn>collapse</dfn>, and the
364+
resulting combined margin is called a <a name="x26"><span class="index-def"
365+
title="collapsing margin"><dfn>collapsed margin</dfn></span></a>.
366+
367+
<P>Adjoining vertical margins collapse, except:
368+
369+
<UL>
370+
<LI>Margins of the root element's box do not collapse.
371+
372+
<LI>If the top and bottom margins of an element with <a
373+
href="visuren.html#clearance">clearance</a> are adjoining, its
374+
margins collapse with the adjoining margins of following siblings
375+
but that resulting margin does not collapse with the bottom margin
376+
of the parent block.
377+
</UL>
378+
379+
<P>Horizontal margins never collapse.
380+
381+
<P ID="what-is-adjoining">Two margins are <a name="x27"><span class="index-def"
382+
title="adjoining margins"><DFN>adjoining</DFN></span></a> if and only if:
383+
384+
<UL>
385+
<LI>both belong to in-flow <a
386+
href="visuren.html#block-boxes">block-level boxes</a> that
387+
participate in the same <a
388+
href="visuren.html#block-formatting">block formatting context</a>
389+
390+
<LI>no line boxes, no clearance, no padding and no border separate
391+
them
392+
393+
<LI>both belong to vertically-adjacent box edges, i.e. form one of
394+
the following pairs:
395+
396+
<UL>
397+
<LI>top margin of a box and top margin of its first in-flow child
398+
399+
<LI>bottom margin of box and top margin of its next in-flow
400+
following sibling
401+
402+
<LI>bottom margin of a last in-flow child and bottom margin of its
403+
parent if the parent has 'auto' computed height
404+
405+
<LI>top and bottom margins of a box that does not establish a new
406+
block formatting context and that has zero computed <a href="visudet.html#propdef-min-height" class="noxref"><span
407+
class="propinst-min-height">'min-height'</span></a>, zero or 'auto'
408+
computed <a href="visudet.html#propdef-min-height" class="noxref"><span class="propinst-min-height">'height'</span></a>, and no
409+
in-flow children
410+
</UL>
411+
</UL>
412+
413+
<P>A collapsed margin is considered adjoining to another margin if any
414+
of its component margins is adjoining to that margin.
415+
416+
<P CLASS=note><STRONG>Note.</STRONG> Adjoining margins can be
417+
generated by elements that are not related as siblings or ancestors.
418+
419+
<DIV CLASS=note>
420+
<P><STRONG>Note</STRONG> the above rules imply that:
421+
422+
<UL>
423+
<LI>Margins between a <a href="visuren.html#floats">floated</a> box
424+
and any other box do not collapse (not even between a float and its
425+
in-flow children).
426+
427+
<LI>Margins of elements that establish new block formatting contexts
428+
(such as floats and elements with <a href="visufx.html#propdef-overflow" class="noxref"><span
429+
class="propinst-overflow">'overflow'</span></a> other than 'visible') do
430+
not collapse with their in-flow children.
431+
432+
<LI>Margins of <a
433+
href="visuren.html#absolutely-positioned">absolutely positioned</a>
434+
boxes do not collapse (not even with their in-flow children).
435+
436+
<LI>Margins of inline-block boxes do not collapse (not even with
437+
their in-flow children).
438+
439+
<LI>The bottom margin of an in-flow block-level element always
440+
collapses with the top margin of its next in-flow block-level
441+
sibling, unless that sibling has clearance.
442+
443+
<LI>The top margin of an in-flow block element collapses with its
444+
first in-flow block-level child's top margin if the element has no
445+
top border, no top padding, and the child has no clearance.
446+
447+
<LI>The bottom margin of an in-flow block box with a <a href="visudet.html#propdef-height" class="noxref"><span
448+
class="propinst-height">'height'</span></a> of 'auto' and a <a href="visudet.html#propdef-min-height" class="noxref"><span
449+
class="propinst-min-height">'min-height'</span></a> of zero collapses
450+
with its last in-flow block-level child's bottom margin if the box
451+
has no bottom padding and no bottom border and the child's bottom
452+
margin does not collapse with a top margin that has clearance.
453+
454+
<LI>A box's own margins collapse if the <a href="visudet.html#propdef-min-height" class="noxref"><span
455+
class="propinst-min-height">'min-height'</span></a> property is zero,
456+
and it has neither top or bottom borders nor top or bottom padding,
457+
and it has a <a href="visudet.html#propdef-height" class="noxref"><span class="propinst-height">'height'</span></a> of either
458+
0 or 'auto', and it does not contain a line box, and all of its
459+
in-flow children's margins (if any) collapse.
460+
</UL>
461+
</DIV>
462+
463+
<P>When two or more margins collapse, the resulting margin width is
464+
the maximum of the collapsing margins' widths. In the case of negative
465+
margins, the maximum of the absolute values of the negative adjoining
466+
margins is deducted from the maximum of the positive adjoining
467+
margins. If there are no positive margins, the maximum of the
468+
absolute values of the adjoining margins adjoining margins is deducted
469+
from zero.
470+
471+
<P ID="collapsed-through">If the top and bottom margins of a box are
472+
adjoining, then it is possible for margins to <a name="x28"><span
473+
class="index-def"><DFN>collapse through</DFN></span></a> it. In this case,
474+
the position of the element depends on its relationship with the other
475+
elements whose margins are being collapsed.
367476

368-
<P>In CSS&nbsp;2.1, <a name="x27"><span class="index-inst" title="horizontal
369-
margin|margin::horizontal">horizontal margins</span></a> never collapse.
477+
<UL>
478+
<LI>If the element's margins are collapsed with its parent's top
479+
margin, the top border edge of the box is defined to be the same as
480+
the parent's.
370481

371-
<P><a name="x29"><span class="index-inst" title="vertical margin|margin::vertical">
372-
Vertical margins</span></a> may collapse between certain boxes:</p>
482+
<LI>Otherwise, either the element's parent is not taking part in the
483+
margin collapsing, or only the parent's bottom margin is
484+
involved. The position of the element's top border edge is the same
485+
as it would have been if the element had a non-zero bottom border.
486+
</UL>
373487

374-
<ul>
375-
<li>Two or more adjoining vertical margins of <a
376-
href="visuren.html#block-boxes">block-level</a> boxes in the <a
377-
href="visuren.html#normal-flow">normal flow</a> collapse. The
378-
resulting margin width is the maximum of the adjoining margin widths.
379-
In the case of negative margins, the maximum of the absolute values
380-
of the negative
381-
adjoining margins is deducted from the maximum of the positive
382-
adjoining margins. If there are no positive margins, the absolute
383-
maximum of the negative adjoining margins is deducted from zero.
384-
<strong>Note.</strong> Adjoining boxes may be generated by
385-
elements that are not related as siblings or ancestors.
386-
387-
<li>Vertical margins between a <a
388-
href="visuren.html#floats">floated</a> box and any other box do not
389-
collapse (not even between a float and its in-flow children).
390-
391-
<li>Vertical margins of elements that establish new block formatting
392-
contexts (such as floats and elements with <a href="visufx.html#propdef-overflow" class="noxref"><span
393-
class="propinst-overflow">'overflow'</span></a> other than 'visible') do
394-
not collapse with their in-flow children.
395-
396-
<li>Margins of <a
397-
href="visuren.html#absolutely-positioned">absolutely</a>
398-
positioned boxes do not collapse (not even with their
399-
in-flow children).
400-
401-
<li>Margins of <a name="x31"><span class="index-inst">inline-block</span></a> elements
402-
do not collapse (not even with their in-flow children).
403-
404-
<li id="collapsed-through">
405-
If the top and bottom margins of a box are adjoining, then it is
406-
possible for margins to collapse through it. In this case, the
407-
position of the element depends on its relationship with the other
408-
elements whose margins are being collapsed.
409-
<ul><li>If the element's margins are collapsed with its parent's top
410-
margin, the top border edge of the box is defined to be the same as
411-
the parent's.</li>
412-
<li>Otherwise, either the element's parent is not taking part in the
413-
margin collapsing, or only the parent's bottom margin is involved. The
414-
position of the element's top border edge is the same as it would have
415-
been if the element had a non-zero bottom border.</li></ul>
416-
417-
<p>An element that has <a
418-
href="visuren.html#clearance">clearance</a> never
419-
collapses its top margin with its parent block's bottom margin.</p>
420-
421-
<p>Note that the positions of elements that have been collapsed
488+
<P>Note that the positions of elements that have been collapsed
422489
through have no effect on the positions of the other elements with
423490
whose margins they are being collapsed; the top border edge position
424-
is only required for laying out descendants of these
425-
elements.</p>
426-
</li>
427-
428-
<li>Margins of the root element's box do not collapse.</li>
429-
430-
</ul>
431-
432-
<div id="what-is-adjoining">
433-
434-
<p>The bottom margin of an in-flow block-level element is always
435-
adjoining to the top margin of its next in-flow block-level
436-
sibling, unless that sibling has <a
437-
href="visuren.html#clearance">clearance.</a></p>
438-
439-
<p>The top margin of an in-flow block box is adjoining to
440-
its first in-flow block-level child's top margin if the element has no
441-
top border, no top padding, and the child has no <a
442-
href="visuren.html#clearance">clearance.</a></p>
443-
444-
<p>The bottom margin of an in-flow block box with a 'height'
445-
of 'auto' is adjoining to its last in-flow block-level child's bottom
446-
margin if the element has no bottom padding or border.
447-
448-
<p>An element's own margins are adjoining if the <a href="visudet.html#propdef-min-height" class="noxref"><span
449-
class="propinst-min-height">'min-height'</span></a> property is zero, and
450-
it has neither top or bottom borders nor top or bottom padding, and it has a
451-
<a href="visudet.html#propdef-height" class="noxref"><span class="propinst-height">'height'</span></a> of either 0 or 'auto',
452-
and it does not contain a line box, and all of its in-flow children's
453-
margins (if any) are adjoining.</p>
454-
455-
<p>When an element's own margins collapse, and that element has
456-
clearance, its top margin collapses with the adjoining
457-
margins of subsequent siblings but that resulting margin does not
458-
collapse with the bottom margin of the parent block.</p>
459-
460-
<p>Collapsing is based on the <em>used value</em> of <a href="box.html#propdef-padding" class="noxref"><span
461-
class="propinst-padding">'padding'</span></a>, <a href="box.html#propdef-margin" class="noxref"><span
462-
class="propinst-margin">'margin'</span></a>, and <a href="box.html#propdef-border" class="noxref"><span
463-
class="propinst-border">'border'</span></a> (i.e., after resolving any
464-
percentages). The collapsed margin is
465-
calculated over the used value of the various margins.</p>
466-
467-
</div>
491+
is only required for laying out descendants of these elements.
468492

469-
<P>Please
470-
consult the <a href="#mpb-examples">examples of margin, padding, and
471-
borders</a> for an illustration of collapsed margins.
472493

473494
<H2>8.4 <a name="padding-properties">Padding properties</a>:
474495
<a href="box.html#propdef-padding-top" class="noxref"><span class="propinst-padding-top">'padding-top'</span></a>,
@@ -752,7 +773,7 @@ <H3>8.5.2 <A name="border-color-properties">Border color</A>:
752773
meanings:</p>
753774

754775
<dl>
755-
<dt><span class="index-inst" title="&lt;color&gt;"><a name="x49" href="syndata.html#value-def-color" class="noxref"><span
776+
<dt><span class="index-inst" title="&lt;color&gt;"><a name="x46" href="syndata.html#value-def-color" class="noxref"><span
756777
class="value-inst-color"><strong>&lt;color&gt;</strong></span></a></span>
757778
<dd>Specifies a color value.
758779
<dt><strong>transparent</strong>

css2/changes.html

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -533,6 +533,10 @@ <H1><a name="q0">Appendix C. Changes</a></H1>
533533
<li class="tocline3"><a href="changes.html#q492" class="tocxref">C.7.103 Section&nbsp;E.2 Painting order</a>
534534
<li class="tocline3"><a href="changes.html#q493" class="tocxref">C.7.104 Appendix&nbsp;G Grammar of CSS&nbsp;2.1</a>
535535
</ul>
536+
<li class="tocline2"><a href="changes.html#q494" class="tocxref">C.8 Changes since the working draft of 7 December 2010</a>
537+
<ul class="toc">
538+
<li class="tocline3"><a href="changes.html#q495" class="tocxref">C.8.1 8.3.1 Collapsing margins</a>
539+
</ul>
536540
</ul>
537541
</div>
538542
<P><em>This appendix is informative, not normative.</em></P>
@@ -6942,6 +6946,21 @@ <h3 id="t.G"><a name="q493">C.7.104 </a><a
69426946

69436947

69446948

6949+
6950+
6951+
<h2 id=errata4><a name="q494">C.8 Changes since the working draft of 7 December 2010</a></h2>
6952+
6953+
6954+
6955+
6956+
<h3 id=u.8.3.1><a name="q495">C.8.1 </a><a
6957+
href="/TR/2010/WD-CSS2-20101207/box.html#collapsing-margins">8.3.1
6958+
Collapsing margins</a></h3>
6959+
6960+
<p>The section is completely rewritten to make the normative text
6961+
shorter and clearer.
6962+
6963+
69456964
<hr class="navbar">
69466965

69476966
<div class="navbar">

css2/cover.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1263,6 +1263,10 @@ <h2><a name="toc">Full Table of Contents</a></h2>
12631263
<li class="tocline3"><a href="changes.html#q492" class="tocxref">C.7.103 Section&nbsp;E.2 Painting order</a>
12641264
<li class="tocline3"><a href="changes.html#q493" class="tocxref">C.7.104 Appendix&nbsp;G Grammar of CSS&nbsp;2.1</a>
12651265
</ul>
1266+
<li class="tocline2"><a href="changes.html#q494" class="tocxref">C.8 Changes since the working draft of 7 December 2010</a>
1267+
<ul class="toc">
1268+
<li class="tocline3"><a href="changes.html#q495" class="tocxref">C.8.1 8.3.1 Collapsing margins</a>
1269+
</ul>
12661270
</ul>
12671271
<li class="tocline1"><a href="sample.html" class="tocxref">Appendix D. Default style sheet for HTML 4</a>
12681272
<li class="tocline1"><a href="zindex.html" class="tocxref">Appendix E. Elaborate description of Stacking Contexts</a>

0 commit comments

Comments
 (0)