html+css实现登录弹出框遮罩层效果,源代码如下:
<!DOCTYPE html>
<html>
<head>
<style type=\'text/css\'>
#lightbox {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
background-color: #000;
opacity: .6;
}
#main {
position: relative;
background-color: #fff;
z-index: 1;
}
</style>
</head>
<body>
<div id=\"main\">Lorem ipsum, my opactiy is not affected</div>
<p>My opactiy is affected</p>
<div id=\"lightbox\"></div>
</body>
</html>
主要使用到css的position相对定位和绝对定位以及z-index属性。
继续阅读与本文标签相同的文章
上一篇 :
车祸之后,AI 如何帮助挽救驾乘生命?
下一篇 :
css 如何将背景图片固定在某一个地方
-
剧情反转?美企主动购买华为5G技术,华为成赞赏排行榜第一名!
2026-05-14栏目: 教程
-
城市数字化后,新一代内生安全系统可全方位保护
2026-05-14栏目: 教程
-
谷歌也来“唱衰”5G,5G手机只会徒增功耗?为何这么说?
2026-05-14栏目: 教程
-
量子信息和量子技术白皮书合肥宣言在中科大发布
2026-05-14栏目: 教程
-
微信悄悄更新一新功能,来看看!
2026-05-14栏目: 教程
