很多时候我们都能够看到,当我们用鼠标移过去的时候,指向的图片将会变成另外一个图片。下面我就将实现该功能的代码分享出来,希望能够帮助到大家。
<!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>
<title> new document </title>
<meta name=”generator” content=”editplus” />
<meta http-equiv=”Content-Type” content=”text/html; charset=utf-8″ />
<style type=”text/css”>
.logo-link {
width:500px;
height:500px;
text-decoration:none;
display:block;
background-image:url(bj1.jpg);
background-position:0px 0;
background-repeat: no-repeat;
}
.logo-link:hover,.logo-link:active {
background-position:0 0;
background-image: url(bj2.jpg);
}
</style>
</head>
<body>
<a href=”http://www.baidu.com” class=”logo-link”></a>
</body>
</html>