【发布时间】:2017-09-15 23:54:11
【问题描述】:
我想为图片添加超链接,但如何在图片中添加href 标签?
<div class="laptop">
<img class='report' src="http://testtest/Report1.png"/>
当报告显示时,您可以单击它并转到该站点。
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;}
<!DOCTYPE html>
<html>
<head>
<link href="style.css" rel="stylesheet" type="text/css">
</head>
<body>
<h1><center>Service Driven, Customer-Centric Solutions,
<br>
Empowered by Innovation.</center></h1>
<div class="laptop">
<img class='report' src="http://mlamannadev.com/Images/Report1.png"/>
<img class='report' src="http://mlamannadev.com/Images/Report2.png"/>
<img class='report' src="http://mlamannadev.com/Images/Report3.png"/>
<img class='report' src="http://mlamannadev.com/Images/Report2.png"/>
</div>
</body>
</html>
【问题讨论】:
-
把img标签放在一个锚标签里面,把href放在锚上。
<a href="#"><img src="..." /></a> -
欢迎来到 StackOverflow,mlamanna!将来,如果您提供您已经尝试过的代码示例以及您得到的结果,您将获得最好的结果。
-
刚刚添加的代码
-
这已经被建议了。试试这个:
<a href="http://your/site.com"><img class='report' src="http://mlamannadev.com/Images/Report1.png"/></a>