我有一個固定位置的導航欄,我試圖推倒一切,如果只有一條警報消息。該警報將被固定也推divs內容的警報
我試圖包裝我的內容在一個部門,但它什麼都沒做。
我用粉底6我發現正是我這裏尋找http://www.bootply.com/4FSUjc2qej
,但它是引導..但如果導航是靜態的,上面的代碼纔有效。如果顯示的信息需要保持固定在導航上方,我需要該信息。但是當點擊關閉網站時滑到正常水平。
<div class="alert alert-info" role="alert">
<button type="button" class="close" data-dismiss="alert">×</button>
<strong>Holy guacamole!</strong> Best check yo self, you are looking very good.
</div>
<div id"site">
<nav class="nav">My Nav</nav>
<div>content</div>
</div>
.alert-info {
margin-bottom:0;
position: fixed
}
.nav {
min-height: 50px;
height: 50px;
overflow: visible;
background-color: #000;
color: #fff;
position: fixed;
top: 0;
z-index: 10000;
}
您應該製作一個位置爲'fixed'的容器/包裝器div,並將該警報和導航器放入該固定div中,而不是使警報和導航都固定。只有一個固定的東西...不是2 – zgood
,但如果我這樣做,它會推動導航下來,但不是網站的其餘部分 – Case
是'固定'的內容將位於靜態內容的頂部......這就是它的工作原理。你需要這樣做嗎?如果某人在你的頁面中間滾動一半並獲得警報,那麼警報會將「固定」導航和「靜態」內容向下推動? – zgood