伪选择器无法提交

时间:2014-05-18 23:34:10

标签: css

有谁能告诉我为什么我的伪选择器无效?

我认为这很简单..

<!DOCTYPE html>

<html>      
    <head>
        <title>test</title> 
    </head>

<body>

    <form id="registerForm" method="POST" action="register_post.php" >
        <p class="registerSubmit">
            <input id="submit" type="submit" name="submit" value="submit">
        </p>
    </form> 

    <style>
        .registerSubmit #submit {
            background: white;
        }

        .registerSubmit #submit :hover {
            background: red;
        }
    <style>

</body>
</html>

非常感谢..谢谢。

2 个答案:

答案 0 :(得分:0)

http://jsfiddle.net/NfYrj/

仅将:hover应用于submit,而不是整个form

#submit:hover {
     background: red;
 }

答案 1 :(得分:0)

请参阅此代码:

    <style>
        .registerSubmit #submit {
            background: white;
        }

        .registerSubmit #submit:hover {
            background: red;
        }
    <style>

再看一次:

.registerSubmit #submit:hover {

最后一次看:

#submit:hover {

Are Achieve能看到空间吗?

再见!