簡體   English   中英

如何保持側邊欄布局固定,不能用引導程序滾動?

[英]How to keep sidebar layout fixed, not scrollable with bootstrap?

我正在嘗試制作一個簡單的管理面板。 我添加了一個側邊欄作為布局。 我想保持它的固定。 但是當我向下滾動頁面時,我的側邊欄也會向下滾動。 這是它在頁面開頭的樣子:

在此處輸入圖像描述

當我向下滾動頁面時:

在此處輸入圖像描述

我想保持它如圖 1 所示,即使頁面向下滾動。 siderbar的開頭是這樣的:

<ul class="navbar-nav bg-gradient-primary sidebar sidebar-dark accordion" id="accordionSidebar" style="max-height:100%">

編輯:我試過.navbar-nav { position: fixed; left: 0; top: 0; bottom: 0, width: 150px; } .navbar-nav { position: fixed; left: 0; top: 0; bottom: 0, width: 150px; } .navbar-nav { position: fixed; left: 0; top: 0; bottom: 0, width: 150px; }結果是: 在此處輸入圖像描述

試試這個方法

<div class="container-fluid">
    <div class="row">
        <div class="col-md-3 px-1 bg-dark position-fixed">
            ...
        </div>
        <div class="col-md-offset-3 col-md-9 col-sm-12">
            <h1>Main Area</h1>
            ...
        </div>
    </div>
</div>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM