Does anybody know a fix for this bug with IE 7... The code should help to explain it:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<style type="text/css">
p {
border:solid #000 2px;
margin:15px 0;
}
div#box {
border:solid #000 2px;
height:55px;
width:200px;
padding:25px;
}
</style>
</head>
<body>
<div id="box">
<p>A test paragraph</p>
</div>
</body>
</html>So all there is is a <div> containing a <p>.
The <p> has a top and bottom margin of 15px
The <div> has a padding of 25px on all sides.
Firefox, Chrome, Safari and Opera all show a 40px gap between the paragraph and the <div>'s top border...which makes sense as that is 15px from the <p>'s margin plus 25px from the <div>'s padding.
Whereas IE 7 (probably 6 as well) likes to forget about <p>'s margin and leaves just a 25px gap between the paragraph and the <div>'s top border.
Has anyone ever come across this before and if so how do you combat it?
Help




















