(编辑:jimmy 日期: 2024/10/31 浏览:2)
本文实例讲述了纯CSS实现图片列表悬停放大效果的方法。分享给大家供大家参考。具体实现方法如下:
复制代码代码如下:<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>片悬停放大</title>
<style>
*{margin:0;padding:0;}
body{margin-top:80px;font-size:12px;font-family:"微软雅黑",arial,sans-serif;color:#9C9C91;background:#fff;}
a {color:#333;text-decoration: none;}
a:hover {color:#f00;}
.wrap {width:720px;background:#f2f2f2;margin:0 auto;}
ul.works {list-style:none;margin:0;padding:0;}
ul.works li {float:left;display: inline;margin:0 20px 20px 0;width:158px;height:150px;}
ul.works li a {text-decoration: none;display:block;width:158px;height:150px;background:#fff;}
ul.works li a img {width:150px;height:140px;border:0;}
ul.works li a .imgthumb {position:relative;background:#EFEFEF;}
ul.works li a .imgthumb span.thumb_shadow_right {position:relative;top:-3px;left:-3px;display:block;border:1px solid #BCBEC0;background:#FFF;padding:3px;text-align:center;}
ul.works li a .intro {display:none;margin-top:5px;height:80px;color:#9C9C91;line-height:1.5;}
ul.works li a .intro p {border-bottom:1px solid #DEDEDD;overflow:hidden;}
ul.works li a:hover {position:absolute;z-index:5;margin:-60px -6px -220px -30px;width:210px;height:273px;background:#CFE798;cursor:pointer;}
ul.works li a:hover .shadow {position:relative;display:block;padding:4px;}
ul.works li a:hover .box {border:1px solid #9FCF30;background:#fff;padding:15px 10px 15px 15px;}
ul.works li a:hover .intro {display:block;}
</style>
</head>
<body>
<div class="wrap">
<ul class="works">
<li><a href="#"><div class="shadow"><div class="box"><div class="imgthumb"><span class="thumb_shadow_right"><img src="/UploadFiles/2021-03-30/wall_s1.jpg"><li><a href="#"><div class="shadow"><div class="box"><div class="imgthumb"><span class="thumb_shadow_right"><img src="wall_s3.jpg"><li><a href="#"><div class="shadow"><div class="box"><div class="imgthumb"><span class="thumb_shadow_right"><img src="wall_s4.jpg"><li><a href="#"><div class="shadow"><div class="box"><div class="imgthumb"><span class="thumb_shadow_right"><img src="wall_s5.jpg"></ul>
</div>
</body>
</html>
希望本文所述对大家的web网页设计有所帮助。