Closed
Bug 275388
Opened 21 years ago
Closed 21 years ago
background clipped at bottom or top if no border
Categories
(Core :: Layout, defect)
Tracking
()
RESOLVED
INVALID
People
(Reporter: laurent, Unassigned)
Details
Attachments
(2 files)
In the following example, the background is not painted above and under the <p>
as it should. Add a border or a padding to the DIV, and it will be painted.
| Reporter | ||
Comment 1•21 years ago
|
||
Comment 2•21 years ago
|
||
This seems odd but I think the example is being rendered correctly. This is a
case of collapsing margins between nested blocks according to the
recommendations http://www.w3.org/TR/REC-CSS2/box.html
The <div> is given the same margin as the <p>, (as can be seen by the space at
the top of the page) and the background colour is only in the div's containing
block, not its margin.
If the div has a border then the margins are no longer adjacent so do not collapse.
(I.E does the same)
| Reporter | ||
Comment 3•21 years ago
|
||
(In reply to comment #2)
> The <div> is given the same margin as the <p>, (as can be seen by the space at
> the top of the page) and the background colour is only in the div's containing
> block, not its margin.
> If the div has a border then the margins are no longer adjacent so do not
collapse.
> (I.E does the same)
Still, I think it's very weird that the margin of the <p> collapses with the 0
width margin of the <div> and that the later "wins" (the p's margin is
transfered to the div's margin).
I would argue that a 0 width margin is not margin, so the there's nothing to
collapse with.
The specs says nothing about 0 width margin. I'll drop a message on www-style@w3.org
Comment 4•21 years ago
|
||
It seems the margin property should be used only to ensure sufficient space
between objects; then margin collapsing is logical. If you want some text with
a coloured area round it you can use padding as in the example.
Comment 5•21 years ago
|
||
Adjoining margins always collapse, even if they happen to have zero length.
http://www.w3.org/TR/CSS21/box.html#collapsing-margins
-> INVALID
Status: UNCONFIRMED → RESOLVED
Closed: 21 years ago
Resolution: --- → INVALID
You need to log in
before you can comment on or make changes to this bug.
Description
•