css变换按钮样式

来源:百度知道 编辑:UC知道 时间:2024/05/25 10:12:13
html里的是:
<input type="submit" name="button" id="button" value="确定" />

css里的是:
#button { width: 36px; height: 18px; border: 0; background-image:url(ok2.png); color:#000; }

#button a:hover {width: 36px; height: 18px; border: 0; background-image:url(ok1.png); color:#FF0000;}

目前运行状况是只显示普通状态下的样式,hover状态下不显示,请问是哪里出了问题呢,或者该怎么改呢

因为是这样的
你的css对hover的设定是#button a:hover 也就是id为button内的<a>超链
但是你真正想实现效果的是button
所以应该这么写css:
#button:hover
也就是#button的hover 而不是a的hover
:)