Dave54
12-10-2007, 05:14 PM
Is there any way around this annoying bug in FireFox? Here's a tiny example to demonstrate the bug:<html>
<head>
<title>test</title>
<style type="text/css">
#box1 {
width: 100px;
padding: 0px;
border-width: 0px;
margin: 0px;
background-color: #f00;
}
#box2 {
width: 100px;
height: 100px;
padding: 0px;
border-width: 0px;
margin: 20px 0px;
background-color: #0f0;
}
</style>
</head>
<body>
<div id="box1">
<div id="box2">
</div>
</div>
</body>
</html>In this example, box2 is inside box1. Box1 has a padding of 0px, and box2 has a top and bottom margin of 20px. In IE, you will see box1 behind box2, both above and below it. However, in FF, there is no margin between box1 and box2. If you give box1 a padding of 1px or more, FF then renders it correctly.
This bug is messing up many of my web designs. Does anyone know a work-around?
<head>
<title>test</title>
<style type="text/css">
#box1 {
width: 100px;
padding: 0px;
border-width: 0px;
margin: 0px;
background-color: #f00;
}
#box2 {
width: 100px;
height: 100px;
padding: 0px;
border-width: 0px;
margin: 20px 0px;
background-color: #0f0;
}
</style>
</head>
<body>
<div id="box1">
<div id="box2">
</div>
</div>
</body>
</html>In this example, box2 is inside box1. Box1 has a padding of 0px, and box2 has a top and bottom margin of 20px. In IE, you will see box1 behind box2, both above and below it. However, in FF, there is no margin between box1 and box2. If you give box1 a padding of 1px or more, FF then renders it correctly.
This bug is messing up many of my web designs. Does anyone know a work-around?