开发者

css buttons and states

开发者 https://www.devze.com 2023-02-02 00:34 出处:网络
Can you apply :hover and :active attributes to input[type=button], or d开发者_运维百科o you have to use a class?You can...* with exceptions. IE6 ONLY supports :hover on a attributes. If you are suppor

Can you apply :hover and :active attributes to input[type=button], or d开发者_运维百科o you have to use a class?


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)


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).


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. :)


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消