Skip to content

Commit 21bbcaf

Browse files
committed
[css2] Moved section on collapsing margins here. Clearly defined (I think) collapsing margin
--HG-- extra : convert_revision : svn%3A73dc7c4b-06e6-40f3-b4f7-9ed1dbc14bfc/trunk%401325
1 parent a26d0f2 commit 21bbcaf

1 file changed

Lines changed: 42 additions & 5 deletions

File tree

css2/box.src

Lines changed: 42 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
22
<html lang="en">
3-
<!-- $Id: box.src,v 1.6 1998-03-17 08:19:42 ijacobs Exp $ -->
3+
<!-- $Id: box.src,v 1.7 1998-03-22 02:02:16 ijacobs Exp $ -->
44
<HEAD>
55
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
66
<TITLE>Box model</TITLE>
@@ -156,7 +156,7 @@ block</a> for the each LI box is the box generated by the UL element.
156156
<li>The height of each LI box is given by its <a
157157
href="#content-height">content height</a>, plus padding, borders, and
158158
margins. Note that vertical margins between the LI boxes <a
159-
href="visudet.html#collapsing-margins">collapse.</a>
159+
href="#collapsing-margins">collapse.</a>
160160

161161
<li>The right padding of the LI boxes has been set to zero width
162162
(the <span class="propinst-padding">'padding'</span> property). The
@@ -207,9 +207,7 @@ for behavior.
207207
</dl>
208208

209209
<P>Negative values for margin properties are allowed, but there may be
210-
implementation-specific limits. Percentage values for margin
211-
properties refer to the width of the generated box's <a
212-
href="visuren.html#containing-block">containing block</a>.
210+
implementation-specific limits.
213211

214212
<!-- #include src=properties/margin-top.srb -->
215213

@@ -295,6 +293,42 @@ below:
295293
</PRE>
296294
</div>
297295

296+
<H3><a name="collapsing-margins">Collapsing margins</a></H3>
297+
298+
<P>In this specification, the expression <span class="index-def"
299+
title="collapsing margin"><dfn>collapsing margins</dfn></span> means
300+
that adjoining margins (no padding or border areas separate them) of
301+
two or more boxes (which may be next to one another or nested) combine
302+
to form a single margin.
303+
304+
<P>In CSS2, <span class="index-inst" title="horizontal
305+
margin|margin::horizontal">horizontal margins</span> never collapse.
306+
307+
<P><span class="index-inst" title="vertical margin|margin::vertical">
308+
Vertical margins</span> may collapse between certain boxes:</p>
309+
310+
<ul>
311+
<li>Two or more adjoining vertical margins of <a
312+
href="visuren.html#block-box">block</a> boxes in the <a
313+
href="visuren.html#normal-flow">normal flow</a> collapse. The
314+
resulting margin width is the maximum of the adjoining margin widths.
315+
In the case of negative margins, the absolute maximum of the negative
316+
adjoining margins is deducted from the maximum of the positive
317+
adjoining margins. If there are no positive margins, the absolute
318+
maximum of the negative adjoining margins is deducted from zero.
319+
320+
<li>Vertical margins between a <a
321+
href="visuren.html#floats">floating</a> box and any other box do not
322+
collapse.
323+
324+
<li>Margins of absolutely positioned boxes do not collapse.
325+
</ul>
326+
327+
<P>In most cases, after collapsing the vertical margins, the result is
328+
visually more pleasing and closer to what the designer expects. Please
329+
consult the <a href="#mpb-examples">examples of margin, padding, and
330+
borders</a> for an illustration of collapsed margins.
331+
298332
<H2><a name="padding-properties">Padding properties</a>:
299333
<span class="propinst-padding-top">'padding-top'</span>,
300334
<span class="propinst-padding-right">'padding-right'</span>,
@@ -414,6 +448,8 @@ font in use.
414448
href="#box-border-area">border area</a> of a box. These
415449
properties apply to all elements.
416450

451+
452+
<!-- Was this to be removed?
417453
<div class="note"><P>
418454
<em><strong>Note.</strong>
419455
Notably for HTML,
@@ -422,6 +458,7 @@ tables, buttons, menus, etc.) differently than for
422458
"ordinary" elements.
423459
</em>
424460
</div>
461+
-->
425462

426463
<H3><a name="border-width-properties">Border width</A>: <span
427464
class="propinst-border-top-width">'border-top-width'</span>, <span

0 commit comments

Comments
 (0)