Reputation: 7673
Can you apply :hover
and :active
attributes to input[type=button]
, or do you have to use a class?
Upvotes: 0
Views: 525
Reputation: 3302
May I suggest a google link. http://cssbutton.com/forms/ with some examples. You will find that older IE versions are picky with this sort of thing.
Upvotes: 0
Reputation: 2801
Yes, you can.
<!DOCTYPE html>
<html>
<head>
<style type="text/css">
input[type=button]:hover {
background: red;
}
</style>
</head>
<body>
<input type="button" value="Hit me" />
</body>
</html>
Of course, beware of IE, but that's a whole different branch of web design. :)
Upvotes: 1
Reputation: 385284
Most modern browsers allow you to use :hover
with any element, but IE is a bit more fiddly about it.
You can use this hack, or do it with Javascript and event handlers (preferable, IMO).
Upvotes: 1
Reputation: 26997
You can...* with exceptions. IE6 ONLY supports :hover on a attributes. If you are supporting IE6, you will need to change the class with JS, if not, you can just use :hover (there are also some IE6 hacks available to bypass this)
Upvotes: 1