CSS3之缩略图作为连接
在CSS3中我们利用border来创建缩略图,并且在图片外层加一个超连接
代码如下:
<!DOCTYPE html>
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>demo</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
*{
margin:0;
padding:0;
}
img{
width:300px;
height: 300px;
/*box-shadow: 10px 10px #999;*/
}
a{
display: inline-block;
border:1px solid #ddd;
border-radius: 8px;
transition: 0.3s;
margin:50px 50px;
}
a:hover{
box-shadow:0 0 6px 6px #999;
}
</style>
</head>
<body>
<a target="_blank" href="./src/img/1.jpeg">
<img src="./src/img/1.jpeg" alt="hhh">
</a>
</body>
</html>
效果:未点击前:
点击图片后: