是否可以为带有地图的块设置半透明框架,以便地图透过它发光并同时保留其功能?在示例中,我使用 before 伪元素实现了它,但是 position: absolute 覆盖了与地图交互的可能性。
<div class="map">
<iframe src="https://yandex.ru/map-widget/v1/-/CCUjn-VQkC" width="100%" height="300" frameborder="0" allowfullscreen="true"></iframe>
</div>
.map {
width: 100%;
max-width: 900px;
position: relative;
}
.map::before {
content: '';
position: absolute;
border: 5px solid rgba(225, 120, 30, 0.3);
top: 0;
right: 0;
bottom: 0;
left: 0;
}
.map iframe {
display: block;
}
或者,添加另一个 div 并使用 4 个伪元素: