Button 式样更换背景图片的有关问题
Button 式样更换背景图片的问题。
界面上有button
以上设置了按钮鼠标悬浮、鼠标点击后更换图片。
现在有问题:
1、如何让图片适应按钮自身大小。(图片存在边框。按钮无边框。)
2、如何让按钮不可用时,背景图片自动更换?且取消hover式样?
(如果不使用js有没有办法实现?)
小弟css不太熟悉,求大神帮忙。
------解决思路----------------------
界面上有button
<input type="button" class="test1" value="test"/>
.test1{
background:'E:\1.jpg' no-repeat;
}
.test1:hove{
background:'E:\2.jpg' no-repeat;
}
.test1:active{
background:'E:\3.jpg' no-repeat;
}
以上设置了按钮鼠标悬浮、鼠标点击后更换图片。
现在有问题:
1、如何让图片适应按钮自身大小。(图片存在边框。按钮无边框。)
2、如何让按钮不可用时,背景图片自动更换?且取消hover式样?
(如果不使用js有没有办法实现?)
小弟css不太熟悉,求大神帮忙。
------解决思路----------------------
<input type="button" class="test1"/>
<input type="button" class="test1" disabled/>
<style>
.test1{border:none;background:url('http://****img.cn/jifen/images/xunzhang/t/t1.png') no-repeat;width:16px;height:16px;}
.test1:hover{background:url('http://****img.cn/jifen/images/xunzhang/t/t2.png') no-repeat;
}
.test1:active{background:url('http://****img.cn/jifen/images/xunzhang/t/t3.png') no-repeat;
}
.test1:disabled{background:url('http://****img.cn/jifen/images/xunzhang/t/t1.png') no-repeat;}
</style>