I'd like to create a fixed sidebar that exists outside my centered Bootstrap Grid. The challenge I face when attempting to do this is determining what additional styles to apply/overwrite to my .container
so that it doesn't overlap my sidebar when the screen is resized.
For starters I'm only using the grid portion of the css framework so the .container
, .row
and .col-md-12
is code pulled from the bootstrap.css
file itself and is not custom. Also keep in mind I'm using Bootstrap 3, so please, no suggestions for a fluid grid solution for Bootstrap 2 that is often asked about in previous threads.
HTML
<div id="left-nav"></div>
<div class="container">
<div class="row">
<div class="col-md-12">
<p>Lorem ipsum dolor sit amet, nunc dictum at.</p>
</div>
</div>
</div>
CSS
html, body {
height: 100%;
width: 100%;
}
#left-nav {
background: #2b2b2b;
position: absolute;
top: 0px;
left: 0px;
height: 100%;
width: 250px;
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…