css - fixed header and margins -


my problem having fixed navigation @ top of page , setting rest of document margin: 0 auto; when page expanded, stays in center. there way have fixed header stay fixed @ center of page when page expands , contracts moving , down page scrolls or no?

.container {      max-width: 1200px;      height: 1200px;      position: relative;      border: 0px;      text-align: center;      left: 30px;  }  .header {      width: 1200px;      height: 140px;      padding: 0px;      border: 0px;      background-color: white;      position: fixed;      left: 50%;      top: 0px;      z-index: 1;  } 

your nav has fixed width? html/css code wishfull.

but having guess, think might help:

.header {     position: fixed;     width: 400px;     left: 50%;     margin-left: -200px; /* 50% of elements width */ } .content {     width: 400px;     margin: 0 auto; } 

demo.


Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -