【发布时间】:2020-10-24 05:02:00
【问题描述】:
我创建了这个小项目来演示我的问题:https://codepen.io/jmdagenais/pen/bGegrEV
.content {
max-width: 450px;
}
.image-wrapper {
height: 135px;
}
.image-wrapper img {
opacity: 25%;
}
.button-section {
text-align: center;
}
<div class="content">
<div class="image-wrapper">
<img src="https://agilewarrior.files.wordpress.com/2014/04/cirlce-illustrator.png?w=500&h=480">
</div>
<div class="button-section">
<a href="http://www.google.com" target="_blank">Google</a>
<a href="http://www.github.com" target="_blank">Github</a>
</div>
</div>
我在工作时在网站上遇到过类似的情况。不是 100% 不透明度的图片上的链接是不可点击的。
如果图像的不透明度为 100%,则链接是可点击的。
有人可以帮我解决这个问题吗?
【问题讨论】:
-
似乎是 z-index 问题。将 wrapper 和 section 设置为相对位置并给出 z 索引值。看起来很奇怪,您不只是使用背景图片。