I am trying to create a layout using a fixed header and sidebar but I wan’t to make the layout in the center of the browser.. Obvisously this is a problem as fixed usually doesn’t allow this. I thought about putting a wrapper around everything and using margin: 0px auto; etc. but that didn’t work, is it possible or not?
#header {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 150px;
background-color: #FFF;
z-index: 100;
}
#content {
width: 1112px;
overflow: auto;
padding-top: 150px;
}
#sidebar {
position: fixed;
top: 0;
left: 0;
width: 275px;
height: 100%;
z-index: 100;
}
Had in mind something like this but it didn’t work:
body {
margin:0px 0px; padding:0px;
text-align:center;
}
#wrapper {
text-align: left;
margin: 0px auto;
}
divs:
<div id="wrapper">
<div id="header"></div>
<div id="content"></div>
<div id="sidebar"></div>
</div>
Try this:
CSS:
HTML:
If I understand your question, I think this is a possible way to do it. Try it, and tell me so! 🙂