Collapsing Elements
This document is open to debate, I have not examined the issues in
depth and may have made any number of mistakes in the assertions
below. If you have any comments to make, e-mail ian@hixie.ch.
- Prerequisites
- Browsers that are subjected to this test should support CSS;
in particular class attributes with multiple keywords and the
height
and width
properties. They also need
to support HTML's rules regarding paragraphs.
1. Should Collapse
There should be nothing coloured between this paragraph and the
next header; only some brief text. This is because all the tests below
should collapse away into nothingness. This is because HTML4, section
9.3.1, says: User
agents should ignore empty P elements
. Also, the final two tests
examine the collapsing margins rules of CSS.
- Control - there should be the same amount of space between this
LI
and the next
as there is between all subsequent list items in this list.
- Empty P:
- Empty P:
- Empty P:
- Empty P:
- Empty P:
- Empty P (*):
- Empty P (*):
- Empty P (*):
- Empty P (*):
- Empty P (*):
- Adjacent margins collapse, even top/bottom of a DIV:
- Adjacent margins collapse, even top/bottom of a DIV separated by a collapsed P:
- Adjacent margins collapse, even top/bottom of a DIV separated by a collapsed P:
- Adjacent margins collapse, even top/bottom of a DIV separated by a collapsed P:
- Adjacent margins collapse, even top/bottom of a DIV separated by a hidden DIV:
- Adjacent margins collapse, even top/bottom of a DIV (*):
- Adjacent margins collapse, even top/bottom of a DIV separated by a collapsed P (*):
- World Economy:
Note. Some of these tests (denoted by '*') are also tested by the
CR/LF test.
2. Should Not Collapse
Below, each description should have a teal box of some sort underneath it.
- Non-empty P (†):
- Non-empty P (†):
- Non-empty P (†):
- Non-empty P (†):
- Non-empty P:
- Non-empty P:
- Non-empty P:
- Non-empty P:
- Sized DIV:
- Sized DIV (same as previous one) (*):
- Sized DIV:
- Sized DIV (same as previous one) (*):
- DIV margins not adjacent (separated by a border - you should see an aqua band across the page):
- DIV margins not adjacent (separated by padding - you should see a teal band across the page):
Note. Some of these tests (denoted by '†') may be considered
empty by some browsers, since they only contain whitespace. I will not
consider this a bug.
Submit Results
Don't forget to ignore tests marked '†' when submitting
results! Non-CSS browsers need only concern themselves with tests
1.1 to 1.11 and 2.5 to 2.8.
Up to the Evil Tests Page.
Bugzilla: Bug 2589
Last updated in March 1999.