Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/36.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 覆盖在引导面板上_Css_Twitter Bootstrap - Fatal编程技术网

Css 覆盖在引导面板上

Css 覆盖在引导面板上,css,twitter-bootstrap,Css,Twitter Bootstrap,我有一个引导面板,如下所示 <div class="panel"> <div class="panel-body"> <div id="panel-overlay"></div> ... </div> </div> #panel-overlay { /* set it to fill the whil screen */ width: 100%; height:

我有一个引导面板,如下所示

 <div class="panel">
   <div class="panel-body">
     <div id="panel-overlay"></div>
     ...
   </div>
 </div>


#panel-overlay {
    /* set it to fill the whil screen */
    width: 100%;
    height: 100%;
    /* transparency for different browsers */
    filter: alpha(opacity = 50);
    -moz-opacity: 0.5;
    -khtml-opacity: 0.5;
    opacity: 0.5;
    background: #000;
    z-index: 3000;
    /* hide it by default */
    display: none;
}

function panelOverlay() {
    var panel = $('.panel');
    var maskHeight = panel.height();
    var maskWidth = panel.width();
    $('#panel-overlay').css({
        height : maskHeight,
        width : maskWidth
    }).show();
}

...
#面板覆盖层{
/*将其设置为填充whil屏幕*/
宽度:100%;
身高:100%;
/*不同浏览器的透明度*/
过滤器:α(不透明度=50);
-moz不透明度:0.5;
-khtml不透明度:0.5;
不透明度:0.5;
背景:#000;
z指数:3000;
/*默认情况下隐藏它*/
显示:无;
}
函数panelOverlay(){
变量面板=$('.panel');
var maskHeight=面板高度();
var maskWidth=panel.width();
$(“#面板覆盖”).css({
身高:马斯赫特,
宽度:马斯克维兹
}).show();
}

如何使覆盖显示在面板上?

为了创建覆盖,应将元素从正常流中移除,并相对于其父元素进行定位

因此,您可以给出
位置:绝对对覆盖元素的声明和相对于面板(容器)的位置

relative
定位在这里用于建立新的定位

例如:

#面板覆盖{
/*将其设置为填充整个面板*/
顶部:0;右侧:0;底部:0;左侧:0;
位置:绝对位置;
}
.panel{位置:相对;}

它需要某种定位设置来利用z索引。您是否尝试将其设置为
位置:相对是的,但它没有显示在上面。除此之外,它还替换了所有内容。给面板一个
位置:相对的
,给覆盖一个
位置:绝对的
。@HashemQolami完美。如果你能添加作为答案,我会接受的。谢谢你的回答!星期一早上帮了大忙。