[英]Bootstrap Navbar-fixed-bottom div overlaps JS rendered content
[英]Bootstrap fixed navbar inside div
在bootstrap文檔中,他們能夠在他們的.bs-docs-example
div中“陷阱” .navbar-fixed-top
:
<div class="bs-docs-example bs-navbar-top-example">
<div class="navbar navbar-fixed-top" style="position: absolute;">
<div class="navbar-inner">
[...]
但是如果我在我的測試頁面中做同樣的事情,導航欄“逃脫”div並固定在身體的頂部,而不是div的頂部。 它是如何實現的?
好想通了。 父元素容器必須具有position: relative
,並且navbar必須具有position: absolute
,如果你附加.navbar-fixed-top
或.navbar-fixed-bottom
,它將相對於父元素而不是相對於整個頁面。 是啊!
<div class="container-fluid">
<div class="container">
<nav class="navbar">...</nav>
</div>
</div>
這適用於內置的Bootstrap的CSS。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.