【问题标题】:i want the link to cover all image我希望链接覆盖所有图像
【发布时间】:2022-12-22 03:50:48
【问题描述】:

我希望链接覆盖所有图像,而不仅仅是当您将鼠标放在图像中心时。 我不知道该怎么做。 请帮忙!!! 我的 HTML:

<div class="moduledata">
<h5><a href="{{seourl}}">{{title}}</a></h5>
<figure><img src="{{pageThumb}}"/></figure>
</div>

我的CSS:

.moduledata{
  position: relative;
  width: auto;
  margin: 0px !important;
  max-width: 380px;
}


.moduledata >  h5{

  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%,-50%);
}

.moduledata >  h5 > a{

  color: #000000;
  font-weight: 300;
  font-size: 38px;
}
.moduledata:hover  h5{
  visibility: visible;
}

.moduledata h5{

  visibility: hidden;

}

【问题讨论】:

    标签: html css


    【解决方案1】:

    您可以将图片包裹在链接中,这样您就可以点击图片上的任何地方

    #comehere {
      margin-top: 2000px;
    }
    <a href="#comehere"><img src="https://via.placeholder.com/150x150" alt=""></a>
    <div id="comehere">here</div>

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-02-15
      • 1970-01-01
      • 1970-01-01
      • 2021-03-04
      • 1970-01-01
      相关资源
      最近更新 更多