应用悬停效果后,无法单击图像链接



我遵循了一个指南,在我的图像中添加悬停效果,以便在上面轻松显示一些文本。问题是我的图像也可以作为链接使用,在应用css后无法点击。有什么办法可以让它们再次点击吗?

.container {
    position: relative;
    width: 200px;
    height: 200px;
    display: inline-block;
}
.image {
    display: block;
    width: 200px;
    height: 200px;
}
.overlay {
    position: absolute;
    transition: all .3s ease;
    opacity: 0;
    background-color: #eee;
}
.container:hover .overlay{
    opacity: 1;
}
.text {
    color: white;
    font-family: sans-serif;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%,-50%);
    font-size: 20px;
}
.overlayFade {
    height: 100%;
    width: 100%;
    top: 0;
    left: 0;
    background-color: #00b1bab3;
}
.container:hover .overlayLeft{
    width: 100%;
}
<div class="container">
            <a href="/carportSpidsTag.jsp"><img src="./IMAGES/fladtTag.png" class="image"></a>
            <div class="overlay overlayFade">
                <div class="text">Fade</div>
            </div>
        </div>

是的,您可以将pointer-events: none;添加到.overlay规则中:

.container {
  position: relative;
  width: 200px;
  height: 200px;
  display: inline-block;
}
.image {
  display: block;
  width: 200px;
  height: 200px;
}
.overlay {
  position: absolute;
  transition: all .3s ease;
  opacity: 0;
  background-color: #eee;
  pointer-events: none;
}
.container:hover .overlay {
  opacity: 1;
}
.text {
  color: white;
  font-family: sans-serif;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 20px;
}
.overlayFade {
  height: 100%;
  width: 100%;
  top: 0;
  left: 0;
  background-color: #00b1bab3;
}
.container:hover .overlayLeft {
  width: 100%;
}
<div class="container">
  <a href="/carportSpidsTag.jsp"><img src="./IMAGES/fladtTag.png" class="image"></a>
  <div class="overlay overlayFade">
    <div class="text">Fade</div>
  </div>
</div>