Margin-Top push outer div down
        Posted  
        
            by Daniel Hertz
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Daniel Hertz
        
        
        
        Published on 2010-04-21T05:14:03Z
        Indexed on 
            2010/04/21
            6:03 UTC
        
        
        Read the original article
        Hit count: 235
        
Hello,
I have a header div as the first element in my wrapper div, but when I add a top margin to a h1 inside the header div it pushes the entire header div down. I realize this happens whenever I apply a top margin to the first visible element on a page.
Here is a sample of the css. Thanks!
    div#header{
    width: 100%;
    background-color: #000;
    position: relative;
}
    div#header h1{
        text-align: center;
        width: 375px;
        height: 50px;
        margin: 0 auto;
        font-size: 220%;
        text-indent: -5000px;
        background: url('../../images/name_logo.png') no-repeat;
    }
html part
<div id="header">
    <h1><a href="/home.php">Title</a></h1>
    <ul id="navbar">
© Stack Overflow or respective owner