制作一个覆盖整个页面的div [英] Making a div that covers the entire page
本文介绍了制作一个覆盖整个页面的div的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想创建一个覆盖整个页面的div。我把一个css风格与高度:100%,但这只涵盖可视区域。
I would like to make a div that covers the entire page. I put a css style with height:100% but this covers only the viewable area. I want it to also cover the area when I scroll down.
推荐答案
使用 position:fixed code>这种方式,您的div将继续在整个可见区域连续。
Use position:fixed
this way your div will remain over the whole viewable area continuously ..
给你的div一个类 overlay
并在CSS中创建以下规则
give your div a class overlay
and create the following rule in your CSS
.overlay{
opacity:0.8;
background-color:#ccc;
position:fixed;
width:100%;
height:100%;
top:0px;
left:0px;
z-index:1000;
}
演示: http://www.jsfiddle.net/TtL7R/1/
这篇关于制作一个覆盖整个页面的div的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文