运行代码框一
提示:您可以先修改部分代码再运行
实例一程序代码如下:
<!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=gb2312" />
<title>用CSS实现缩略图鼠标移上去显示大图</title>
<style type="text/css">
<!--
.list{position:relative;}
.list span img{ /*CSS for enlarged image*/
border-width: 0;
padding: 2px; width:500px;
}
.list span{
position: absolute;
padding: 3px;
border: 1px solid gray;
visibility: hidden;
background-color:#FFFFFF;
}
.list:hover{
background-color:transparent;
}
.list:hover span{
visibility: visible;
top:0; left:60px;
}
-->
</style>
</head>
<body>
<p> </p>
<div>
<a class="list" href="http://www.cssplay.org.cn/css-example/20080812/642.html" _fcksavedurl="http://www.cssplay.org.cn/css-example/20080812/642.html"><img src="http://www.cssplay.org.cn/uploads/allimg/080812/0644500.jpg" _fcksavedurl="http://www.cssplay.org.cn/uploads/allimg/080812/0644500.jpg" width="156" height="122" border="0" /><span><img src="http://www.cssplay.org.cn/uploads/allimg/080812/0644500.jpg" _fcksavedurl="http://www.cssplay.org.cn/uploads/allimg/080812/0644500.jpg" alt="big" /></span></a></div>
</body>
</html>
运行代码框二
提示:您可以先修改部分代码再运行
实例二程序代码如下:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>用CSS实现缩略图鼠标移上去显示大图</title>
<style type="text/css">
<!--
.cssplay { position:relative; }
.cssplay a { border:1px solid gray; padding:3px; width:200px; height:153px; font-size:12px; text-decoration:none; background:url("no.gif"); position:absolute; left:0; top:0; z-index:2; text-indent:-9999px; }
.cssplay a:hover { width:10px; height:362px; padding:10px 494px 0 10px; text-indent:0; background:#fff url("http://www.cssplay.org.cn/uploads/allimg/080812/0644500.jpg") no-repeat 35px 3px; }
.cssplay img { border:1px solid gray; padding:3px; width:200px; position:relative; z-index:1;}
.cssplay2 a { display:block; width:206px; }
.cssplay2 a img { border:1px solid gray; padding:3px; width:200px; }
.cssplay2 a:hover { border:1px solid gray; padding:3px; width:200px; height:369px; padding:3px 484px 0 3px; font-size:12px; text-decoration:none; text-indent:0; background:#fff url("http://www.cssplay.org.cn/uploads/allimg/080812/0644500.jpg") no-repeat 206px 3px; }
.cssplay2 a:hover img { border:none; padding:0; }
-->
</style>
</head>
<body>
<div class="cssplay">
<img src="http://www.cssplay.org.cn/uploads/allimg/080812/0644500.jpg" alt="big" />
<a href="#">效果一</a>
</div>
<div class="cssplay2">
<a href="#"><img src="http://www.cssplay.org.cn/uploads/allimg/080812/0644500.jpg" alt="效果二" /></a>
</div>
</body>
</html>

