html - How do I margin a div as much as another? -


i want holder not overlap navbar, can set holder's margin-top as navbar without putting in numbers?

here's html,

#navbar {    list-style-type: none;    margin: 0;    padding: 0;    overflow: hidden;    background-color: grey;    position: fixed;    top: 0;    width: 100%;  }  #holder {    min-height: 100%;    background-color: #f7f4ee;    position: relative;  }
<div>    <ul id="navbar">      <li><a class="active" href="home.html">home</a>      </li>      <li><a href="news.html">news</a>      </li>      <li><a href="about.html">about</a>      </li>    </ul>  </div>    <div id="holder">    <header>""</header>    <div id="body">""</div>    <footer>""</footer>  </div>

thanks.

try use this

margin: 0 auto; 

and addition, can use this

display: block; margin: 0 auto; 

remember put on css become this

#navbar {     list-style-type: none;     margin: 0;     padding:0;     overflow: hidden;     background-color: grey;     position: fixed;     top: 0;     width: 100%;     display: block;     margin: 0 auto; }  #holder {     min-height: 100%;     background-color: #f7f4ee;     position: relative;     display: block;     margin: 0 auto; } 

Comments

Popular posts from this blog

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project.Error occurred in starting fork -

windows - Debug iNetMgr.exe unhandle exception System.Management.Automation.CmdletInvocationException -

configurationsection - activeMq-5.13.3 setup configurations for wildfly 10.0.0 -