我想創建一個固定的側邊欄,其存在我的居中Bootstrap網格。嘗試執行此操作時遇到的挑戰是確定要將其他樣式應用/覆蓋到我的.container
,以便在屏幕調整大小時不會與我的側邊欄重疊。在居中的Bootstrap 3網格旁邊創建一個固定的側邊欄
對於我只使用了CSS框架的柵格部首發所以.container
,.row
和.col-md-12
代碼是從bootstrap.css
文件本身拉動,而不是定製的。另外請記住,我正在使用Bootstrap 3,所以請不要在Bootstrap 2的流體網格解決方案中提出建議,這在以前的線程中經常會被問到。
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;
}
這是你在找什麼:http://startbootstrap.com/templa tes/simple-sidebar.html –
看起來是這樣的。非常感謝。 –
以上鍊接不再適用。 –