如何超链接图像

mla*_*nna 2 html image class href

我想为图像添加超链接,但如何href向图像添加标签?

<div class="laptop">
    <img class='report' src="http://testtest/Report1.png"/>
Run Code Online (Sandbox Code Playgroud)

当报告显示时,您可以单击它并转到该站点。

<div class="laptop">
    <img class='report' src="http://testtest/Report1.png"/>
Run Code Online (Sandbox Code Playgroud)
h1{
    font-family: Arial Rounded MT Bold;
    font-size: 33px;
    color: #0F4194;
    float: left;
    margin: 50px 0px 15px 700px;
    
}

.laptop{
  width:1024px;
  height:661px;
  float: center;
  margin-right: -150px;
  background: url('http://mlamannadev.com/Images/Laptop2.png');
  background-repeat: no-repeat;
  background-position: top left;
  background-size: contain;
  width: 1024px;
  z-index:4;
}

.report{
  position:absolute;
  animation:round 16s infinite;
  opacity:0;
  z-index:-1;
  margin-left: auto;
  margin-right: auto;
  display: block;
  
}
@keyframes round{   
  25%{opacity:1;}
  40%{opacity:0;}
} 

img:nth-child(4){animation-delay:0s;}
img:nth-child(3){animation-delay:4s;}
img:nth-child(2){animation-delay:8s;}
img:nth-child(1){animation-delay:12s;}
Run Code Online (Sandbox Code Playgroud)

小智 7

<img>标签放入标签内<a>并提供href.

<a href="/link/to/site">
  <img src="" />
</a>
Run Code Online (Sandbox Code Playgroud)

  • 这会导致图像的大小和布局不正确,为什么“a”标签对 CSS 如此具有破坏性? (2认同)