我有3個引導列彼此相鄰。我希望左右列是靜態的,只有中間的列必須滾動。如何使自舉左右欄靜態
我試過讓列固定,但是這改變了列的寬度,如果我修正了右列,那麼它會被推到頁面的左邊。
有沒有另一種方法可以修復它沒有固定的屬性?
這裏是我的代碼:
<div class=" col col-sm-2 leftBar" style="padding: 10px;">
<div style="padding: 10px 10px; border-radius: 5px; background-color: #87CEEB;">
<div class="list-group">
<a href="#" class="list-group-item active">List <span class="badge">4</span></a>
<a href="#" class="list-group-item"> List Item 1</a>
<a href="#" class="list-group-item"> List Item 2</a>
<a href="#" class="list-group-item"> List Item 3</a>
<a href="#" class="list-group-item"> List Item 4</a>
</div>
</div>
</div>
<div class=" col col-sm-8 centreContent" style="padding: 10px;">
<div style="padding: 10px 10px; border-radius: 5px; background-color: #DCDCDC;">
<p>This is the content</p>
<p>This is the content</p>
<p>This is the content</p>
<p>This is the content</p>
<p>This is the content</p>
<p>This is the content</p>
<p>This is the content</p>
<p>This is the content</p>
<p>This is the content</p>
<p>This is the content</p>
<p>This is the content</p>
<p>This is the content</p>
<p>This is the content</p>
<p>This is the content</p>
<p>This is the content</p>
<p>This is the content</p>
<p>This is the content</p>
<p>This is the content</p>
<p>This is the content</p>
<p>This is the content</p>
<p>This is the content</p>
<p>This is the content</p>
<p>This is the content</p>
<p>This is the content</p>
<p>This is the content</p>
<p>This is the content</p>
<p>This is the content</p>
<p>This is the content</p>
<p>This is the content</p>
<p>This is the content</p>
<p>This is the content</p>
<p>This is the content</p>
<p>This is the content</p>
<p>This is the content</p>
<p>This is the content</p>
<p>This is the content</p>
<p>This is the content</p>
<p>This is the content</p>
<p>This is the content</p>
<p>This is the content</p>
<p>This is the content</p>
<p>This is the content</p>
</div>
</div>
<div class=" col col-sm-2 rightBar" style="padding: 10px;">
<div style="padding: 10px 10px; border-radius: 5px; background-color: #87CEEB;">
<p>This is the Right Bar</p>
</div>
</div>
如果您將RightBar放置在右側,固定位置將會很好。 https://jsfiddle.net/9zgeqv3s/在中央列加上自舉偏移 –
Thanx @ GL.awog。這是我想要的方式。請張貼它作爲答案,以便我可以接受它。 – Damian