搜尋

首頁  >  問答  >  主體

如何使連結覆蓋整個圖像?

我希望連結覆蓋所有圖像,不僅是在中心,而且當您將滑鼠懸停在圖像上時。

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

.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;

}

1

2

3

4

<div class="moduledata">

  <h5><a href="{{seourl}}">{{title}}</a></h5>

  <figure><img src="{{pageThumb}}"/></figure>

</div>

P粉481815897P粉481815897338 天前597

全部回覆(1)我來回復

  • P粉191323236

    P粉1913232362024-04-03 18:08:52

    您可以將圖像包含在連結內,這樣您就可以點擊圖像上的任意位置來存取該連結。

    1

    2

    3

    #comehere {

      margin-top: 2000px;

    }

    1

    2

    <a href="#comehere"><img src="https://via.placeholder.com/150x150" alt=""></a>

    <div id="comehere">here</div>

    回覆
    0
  • 取消回覆