How to style input fields with CSS?

There are situations where you need to style input fields depending on there types.

Doing this is wrong:

input{
    border:solid 1px red;
}
bad input css

As you see in the image, the CSS rule has been applied to all input fields (a text input field, and an image input)

You can specify the type of input field that you are targeting by doing like this:

input[type="password"]{
    border:solid 1px red;
}
good input css

Related links

Leave a Reply

Your email address will not be published. Required fields are marked *

*

* Copy this password:

* Type or paste password here:

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="" highlight="">