input[type='text'][name='last_name'] : attribute selector « Style Basics « HTML / CSS






input[type='text'][name='last_name']

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
                      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns='http://www.w3.org/1999/xhtml' xml:lang='en'>
    <head>
        <title>Attribute Selectors</title>
        <style rel='stylesheet' type='text/css'>
input[type='text'][name='last_name'] {
    background: forestgreen;
    color: yellowgreen;
    border: 3px solid yellowgreen;
}
        
        </style>
    </head>
    <body>
        <form method='post' action=''>
            <fieldset>
                <legend>Feedback Form</legend>
                <table>
                    <tbody>
                        <tr>
                            <td>
                                <label for='first-name'>First Name:</label>
                            </td>
                            <td>
                                <input type='text'
                                       name='first_name'
                                       id='first-name'
                                       value=''
                                       size='25' />
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <label for='last-name'>Last Name:</label>
                            </td>
                            <td>
                                <input type='text'
                                       name='last_name'
                                       id='last-name'
                                       value=''
                                       size='25' />
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <label for='account-password'>Password:</label>
                            </td>
                            <td>
                                <input type='password'
                                       name='password'
                                       id='account-password'
                                       size='25'
                                       value='' />
                            </td>
                        </tr>
                    </tbody>
                </table>
            </fieldset>
        </form>
    </body>
</html>

 








Related examples in the same category

1.A blockquote with a cite attribute displayed with CSS
2.p[title] selects all paragraphs containing a title attribute.
3.p[title~="paragraph"] selects all paragraphs with a title attribute containing the word, paragraph.
4.Matches are case sensitive and must match letter-for-letter including whitespace
5.p[title="myPara"] selects all paragraphs with a title attribute containing the exact text, myPara
6.Attribute Selectors for form controls
7.Attribute Substring Selectors
8.Attribute Substring Selectors: a[href^="ftp://"]
9.Attribute Substring Selectors: a[href*="#"]
10.Attribute Substring Selectors: a[href$=".html"]
11.Attribute Substring Selectors: a[href$=".pdf"]
12.input[type='password'][name='password']
13.input[type='text']