0
我想创建一个双箱阴影效果,就像一个页面上的两个聚光灯。创建双箱阴影效果(如两个聚光灯)
代码和小提琴:
<style>
.greenbox1{
position: relative;
height: 100px;
width: 100px;
margin-left: 100px;
text-align:center;
background-color:#00aa00;
float:left;
}
.greenbox2{
position: relative;
height: 100px;
width: 100px;
text-align:center;
margin-right: 100px;
background-color:#00aa00;
float:right;
}
.spotlightme{
box-shadow: 0 0 0 1000px rgba(0, 0, 0,.4);
position: relative;
z-index: 99;
border-radius:10px;
padding: 10px;
}
</style>
<div class="greenbox greenbox1">
<span class="spotlightme">spotlight</span>
</div>
<div class="greenbox greenbox2">
<span class="spotlightme">spotlight</span>
</div>
在此的jsfiddle,都是太阴暗:https://jsfiddle.net/7htp62h1/6/
而在这其中,只有一个具有正确的聚光灯: https://jsfiddle.net/7htp62h1/8/
我会就像在那里,在页面的其余部分上都会有“聚光灯”和类似的阴影。
作为奖励,我很想知道如何让这些聚光灯效果“淡入”。
谢谢!
你好,谢谢你的回复。我希望能让整个页面变得更暗,只有两个聚光灯。在这个版本中,“聚光灯”这个单词周围的区域变暗,但不是整个页面。 – garson