Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

Why is there padding between my first nav and the body?

Why is there padding between my first nav and the body?

Problem

I though the first part of my css would make no Padding in the body. This is enough content to explain my problem stackoverflow, please allow me to post my question now.

The CSS:

*{ 
    margin: 0px;
    padding: 0px;
}

header, nav, section, aside, footer{display: block}

body{
    border: solid red 2px;
}

nav{
    border: solid black 2px;
}

The HTML:

 
         
                     
            redditClone     
                   
             
        
            

Reddit

Problem courtesy of: user1656125

Solution

I don't see any padding in Chrome, FF or IE9, but...

try to change this:

header nav section aside footer{display: block}

to this:

header, nav, section, aside, footer {display: block; padding: 0px; margin: 0px; }

you must use commas to select many elements

Solution courtesy of: Peter

Discussion

View additional discussion.



This post first appeared on CSS3 Recipes - The Solution To All Your Style Problems, please read the originial post: here

Share the post

Why is there padding between my first nav and the body?

×

Subscribe to Css3 Recipes - The Solution To All Your Style Problems

Get updates delivered right to your inbox!

Thank you for your subscription

×