Closed
Bug 426314
Opened 17 years ago
Closed 17 years ago
element with native margin-top causes margin-top in parent element
Categories
(Firefox :: General, defect)
Tracking
()
RESOLVED
DUPLICATE
of bug 376647
People
(Reporter: kae, Unassigned)
Details
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.13) Gecko/20080325 Fedora/2.0.0.13-1.fc8 Firefox/2.0.0.13
Build Identifier: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.13) Gecko/20080325 Fedora/2.0.0.13-1.fc8 Firefox/2.0.0.13
elements with native margin-top, such as <h1>, <h2>, appear to be causing their parent elements to exhibit those same margins.
for example, if you have the simple HTML <div></div><div><h1>test</h1></div>, it is expected that the native margin in the <h1> will cause a space between itself and the start of its parent <div>. Instead, it is causing a space between the two <div> elements.
Reproducible: Always
Steps to Reproduce:
1. view the sample HTML in a browser
Actual Results:
space between two <div>s
Expected Results:
space above <h1>, but not between <div>s
sample HTML to show the problem:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Example of box-model breakage bug</title>
<style type="text/css">
#top-banner { height:131px; background: #13579a; }
#content { height:131px; background: #a0a0a0; }
</style>
</head>
<body>
<div id="top-banner"></div>
<div id="content">
<h1>There should not be a white bar above this</h1>
</div>
</body>
</html>
note that if you add a border of at least 1px to the #content div, the space disappears...
Comment 1•17 years ago
|
||
This is the expected behaviour, you need to read about collapsing margins.
Status: UNCONFIRMED → RESOLVED
Closed: 17 years ago
Resolution: --- → DUPLICATE
You need to log in
before you can comment on or make changes to this bug.
Description
•