标签:
<!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 type="text/css">
body{margin: 0;padding: 0;font: normal 10px Verdana, Arial, Helvetica, sans-serif;line-height: 1.8em;background: #1d1d1d url(bg.jpg) repeat;}
a{color:#999;}
h1{font-family:Georgia, "Times New Roman", Times, serif;text-align: center;font-weight: normal;font-size: 4em;line-height: 1.2em;margin: 0; padding: 20px 0;color:#999;font-size:18px;}
img{border: none;}
ul.gnineh{width: 960px;list-style: none;margin: 0 auto; padding: 0;}
ul.gnineh li{width: 220px;float: left; display: inline;margin: 10px; padding: 0;position: relative;}
ul.gnineh li:hover{z-index: 99;}
ul.gnineh li img{position: relative;filter: alpha(opacity=30);opacity: 0.3;-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=30)";}
ul.gnineh li:hover img{z-index: 999;filter: alpha(opacity=100);opacity: 1;-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)";}
ul.gnineh li .info{position: absolute;left: -10px; top: -10px;padding: 210px 10px 20px;width: 220px;display: none;background: #fff;font-size: 1.2em;-webkit-border-radius: 3px;-moz-border-radius: 3px;border-radius: 3px;}
ul.gnineh li:hover .info{display: block;}
ul.gnineh li h2{font-size: 1.2em;font-weight: normal;text-transform: uppercase;margin: 0; padding: 10px 0;}
ul.gnineh li p{padding: 0; margin: 0; font-size: 0.9em;}
body{font-size:12px;font-family:‘Arial‘;line-height:25px;}
#header{background:#000;height:30px;line-height:30px;margin-bottom:20px;}
#header h2{float:left;margin:0px 10px;}
#header h2 a{color:#fff;}
#main{width:950px;margin:0px auto}
.code{border:#ccc 1px solid;background:#ffffcc;padding:10px;}
</style>
</head>
<body>
<h1>纯CSS实现的鼠标触及显示边框和描述的图片特效</h1>
<ul class="gnineh">
<li>
<a href="/">
<img src="images/31.jpg" >
</a>
<div class="info">
<h2>美丽荃银高科</h2>
<p>新车上市堪比波音。</p>
</div>
</li>
<li>
<a href="/">
<img src="images/31.jpg" >
</a>
<div class="info">
<h2>我的小狗</h2>
<p>很可爱的猩猩</p>
</div>
</li>
<li>
<a href="/">
<img src="images/31.jpg" >
</a>
<div class="info">
<h2>穿过市区</h2>
<p>是郊外的清凉</p>
</div>
</li>
<li>
<a href="/">
<img src="images/31.jpg" >
</a>
<div class="info">
<h2>梦中情人</h2>
<p>回首一眸万物俱焚</p>
</div>
</li>
</ul>
</body>
</html>
标签:
原文地址:http://www.cnblogs.com/lily2015/p/4661927.html