Highlight active form with CSS?

Posted by 2unco on Stack Overflow See other posts from Stack Overflow or by 2unco
Published on 2012-06-23T02:41:26Z Indexed on 2012/06/23 3:16 UTC
Read the original article Hit count: 113

Filed under:
|
|
|
<!doctype html>
<html lang="en">
    <head>
        <meta charset="utf-8"/>
        <style>
            form:focus{
                background:red;
            }
        </style>
        <title>Home, sweet home</title>
    </head>
    <body>
        <form>
            <input type="text"/>
            <input type="submit"/>
        </form>
        <form>
            <input type="text"/>
            <input type="submit"/>
        </form>
        <form>
            <input type="text"/>
            <input type="submit"/>
        </form>
    </body>
</html>

This obviously doesn't work, as is why I'm asking the question. How can I get the form which has one if it's inputs as the focus to highlight? That is, I want to be able to apply styles to the active FORM, not the active INPUT - is that doable without JS or something?

© Stack Overflow or respective owner

Related posts about html

Related posts about css