Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/32.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Css 引导移动导航,想要;在“上落”;现有内容(z索引)_Css_Twitter Bootstrap_Position_Z Index - Fatal编程技术网

Css 引导移动导航,想要;在“上落”;现有内容(z索引)

Css 引导移动导航,想要;在“上落”;现有内容(z索引),css,twitter-bootstrap,position,z-index,Css,Twitter Bootstrap,Position,Z Index,我有一个使用bootstrap的移动导航,我想在现有内容下降时将其折叠(而不是将内容向下推) 我已经试过在我能想到的所有东西上设置位置:相对和z-index:9999: @media (max-width: 768px) { .navbar-collapse { width: 200px; float: right; position: relative !important; z-index: 9999 !important; } .navbar {

我有一个使用bootstrap的移动导航,我想在现有内容下降时将其折叠(而不是将内容向下推)

我已经试过在我能想到的所有东西上设置
位置:相对
z-index:9999

@media (max-width: 768px) {
.navbar-collapse {
    width: 200px;
    float: right;
    position: relative !important;
    z-index: 9999 !important;

}
.navbar {
    width: 200px;
    float: right;
    position: relative !important;
    z-index: 9999 !important;

}
.collapse {
    position: relative !important;
    z-index: 9999 !important;
}
}

到目前为止,一切都不起作用,有人知道修复方法吗?

您不应该在导航栏中使用诸如“相对”之类的属性。如果您使用引导固定导航栏,那么您将能够实现您想要的结果

<nav class="navbar navbar-default navbar-fixed-top">

下面是一个类似这样的例子


我想这样做,但不幸的是导航不能固定在屏幕顶部,它需要保持向上滚动并保持在页面顶部。
.navbar-static-top {
    position:absolute;
   width:100%;

}