Closed
Bug 298370
Opened 20 years ago
Closed 20 years ago
CSS floating div or span has extra padding at top and bottom
Categories
(Firefox :: General, defect)
Tracking
()
RESOLVED
INVALID
People
(Reporter: sethlivingston, Unassigned)
Details
Attachments
(1 file)
609 bytes,
text/html
|
Details |
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.8) Gecko/20050511 Firefox/1.0.4
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.8) Gecko/20050511 Firefox/1.0.4
Adding the CSS float property to a div or span adds extra padding at the top and
bottom of the div or span. The padding can't be removed or reduced.
Reproducible: Always
Steps to Reproduce:
Reproduced in attached HTML file.
Actual Results:
The floating element has extra padding at the top and bottom.
Expected Results:
Shown zero padding at the top and bottom.
Reporter | ||
Comment 1•20 years ago
|
||
Comment 2•20 years ago
|
||
Well, the <p> tag has a default margin-top and margin-bottom of 1em, so that's
why you see the extra space.
Comment 3•20 years ago
|
||
This is INVALID. The behaviour is completely correct.
If you wish to remove the margins, remove them from the <P> inside the <DIV>
(see also collapsing margins in the CSS 2.1 spec
<http://www.w3.org/TR/CSS21/box.html#x22>).
The margin of the <P> in the left col collapses into the <DIV> and the <BODY>,
resulting it is visually appearing as if the margin was on the <BODY> (which
already has a similar margin, thus it looks fine).
In the right col, the margin of the <P> can not collapse at all, as the <DIV> is
floated, thus you end up with the margin visually appearing on the <P> itself.
You could use the DOM Inspector to see the areas covered by each element to see
how it affects the position/margins of each element.
Status: UNCONFIRMED → RESOLVED
Closed: 20 years ago
Resolution: --- → INVALID
You need to log in
before you can comment on or make changes to this bug.
Description
•