我想创建一个教程, bootstrap 用户准确地点击哪里.我试着用一个<div>
来覆盖整个屏幕,这个<div>
会使所有元素变暗,除了固定的width
、height
、top
和left
中的specific region.
问题是,我找不到一种方法来"取消"父母的background-color
(这也是透明的).
在下面的片段中,hole
是应该没有任何background-color
的div,包括其父目录.
这能实现吗?有什么 idea 吗?
#bg{
background-color:gray;
opacity:0.6;
width:100%;
height:100vh;
}
#hole{
position:fixed;
top:100px;
left:100px;
width:100px;
height:100px;
}
<div id="bg">
<div id="hole"></div>
</div>
下面是我试图实现的一个模型图像: