Hi, I have a paragraph within a nested div with some padding, this works OK, apart from the bottom div, theres no difference between the 2? It displays fine in FF but not in IE, I belive it's something to do with the paragraph settings in IE. Here Check out this example: HTML: <div id="div1"> <div class="nested"> <p>This is fine</p> </div> <div class="nested"> <p>This is fine</p> </div> <div class="nested"> <p>This isn't fine, what's so different? Wheres the 20px red below this that shows in FF?</p> </div> </div> CSS: p { margin: 0; padding: 10px; } #div1 { background-color: red; padding: 10px; } .nested { background-color: pink; margin: 10px; } Many Thanks in advance to anybody who can help in any way.
The problem is only in IE 6. Try adding a clear BR after the P: <br clear="all"> like this: <div class="nested"> <p>This isn't fine, what's so different? Wheres the 20px red below this that shows in FF?</p> <br clear="all"> </div>
Hey, the problem is definatley in IE 7 also i just copied the code exactly from this thread to double check, the problem is that the last (third) div at the bottom does not close off properly. A solution to this would be to add 10px padding to all the Div's rather than the paragraphs I reckon but this would cause more hassle and more CSS. I tried the <br clear="all" /> and it worked fine, however this then produces an unwanted space at the bottom of the div, from the line break. Simply putting a space (  , after the closing </p> tag works, but this again produces unwanted space. It seems it is nothing to do with clearing as theres nothing to clear, but it requires some text after the closing </p> for the padding to work properly for some reason!! Here is an extreme example of the problem just to point of the problem in IE: <!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> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Untitled Document</title> <style type="text/css" media="screen"> p { margin: 0; padding: 10px; } #div1 { background-color: red; padding: 10px; } .nested { background-color: pink; margin: 100px; } </style> </head> <body> <div id="div1"> <div class="nested"> <p>This div doesn't close off properly, it should only have 10px padding at the bottom.</p> </div> </div> </body> </html> Code (markup): I've solved it at the moment by just adding some text that i didn't really want to add underneath the div which forces it to close, however it would be interesting to know why this happens.