Html/css question . margin-top only works if padding-top exists?



In the following code if ‘padding-code:15px’ is removed then the line ‘margin-top’ (in #main-nav) stops having any effect whatsoever. why ?
Please analyze the code carefully. I am soo frustrated right now.



ok it does have an effect , but not the expected effect of giving main-nav a margin

One Reply to “Html/css question . margin-top only works if padding-top exists?”

  1. It actually dose have an effect. if you notice the header sections background remains blue yet it has no Class or ID associated with it.

    This would have a similar effect as the padding top:

    #page-container {
    position:absolute;
    top:15px;
    width:100%;
    background: blue;

    }

    Basically your #page-container is is given a 15 pixel pad from position zero with padding-top:15px;





Leave a Reply

Your email address will not be published. Required fields are marked *