CSS控制当鼠标滑过时更换图片的效果

建站知识 2021-07-03 08:43www.168986.cn长沙网站建设

复制代码
代码如下:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://.w3./TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://.w3./1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>CSS实现鼠标移动到图片,更换图片</title>
</head>
<style type="text/css">
{ margin:0; padding:0;}
ul li{ list-style:none;}
.nav{ width:800px; height:40px; margin:150px auto;}
.nav ul li{ float:left; width:200px;}
.nav ul li a:link,a:visited{ display:block; width:190px; height:40px; background:url(/jscss/demoimg/wall_s1.jpg);}/链接、点击后/
.nav ul li a:hover{background:url(/jscss/demoimg/wall_s2.jpg);}/鼠标经过/
.nav ul li a:active{background:url(/jscss/demoimg/wall_s3.jpg);}/点击时/
</style>
<body>
<div class="nav">
<ul>
<li><a href="#"></a></li>
<li><a href="#"></a></li>
<li><a href="#"></a></li>
</ul>
</div>
</body>
</html>

Copyright © 2016-2025 www.168986.cn 狼蚁网络 版权所有 Power by