treehouse : what would you like to learn today?
Web Design Web Development iOS Development

disappearing margin colors


  • <!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>Model Test Box</title>
    <style type=\"text/css\">
    * {margin: 0; padding: 0; border: 0; }
    body {font-family: Arial, Helvetica, sans-serif; background: green; color: black; font-size: 15px;}
    #wrapper {margin: 0 auto; width: 960px; background: #eee;}
    #box {border: 5px solid blue; padding: 20px; margin: 20px; background: #ccc;}
    p {padding: 10px;}
    </style>
    </head>
    <body>
    <div id=\"wrapper\">
    <div id=\"box\">
    <p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames.</p>
    </div>
    </div>
    </body>
    </html>


    In this example, in FF, the wrapper top and bottom margins' color disappears? It shows up ok on IE7. The color of the
    top and bottom margins reverts ro the color specified for the background, not the wrapper.

    What is going on here?

    Al
  • found something that does work, put padding on the wrapper, and side margin on the box

    Al
  • Margins between elements will not show the background color of that div. That is how they work.

    http://lkamal.blogspot.com/2006/12/marg ... rties.html