css按钮:ACTIVE点击切换背景图片

html-css019

css按钮:ACTIVE点击切换背景图片,第1张

<!DOCTYPE html>

<html>

<head>

<style>

#btn{background:red}

#btn:hover{background:blue}

</style>

</head>

<body>

<input id="btn" type="button"/>

</body>

</html>

经验证是可以的,或许是你的图片路径不对,不过ie6不支持伪类:hover属性,所以如果要兼容ie6就用js或者,用a标签来代替吧

1、新建html文档。

2、准备好需要用到的图标。

3、书写hmtl代码。<div id="aaaa"><ul>,<li><img src="lanren01.jpg" width="218" height="155" /><h2>成都康定理塘稻城亚丁然后说再见</h2></li>。

4、书写css代码。<style>*{ margin:0padding:0list-style:none}img{ border:0}body{ background:#000};#aaaa{ width:460pxheight:automargin:150px autooverflow:hidden}。

5、书写并添加js代码。<script src="jquery.min.js"></script><script>$(function(){var imgs = $('#aaaa li')

6、代码整体结构。