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

Leave a Reply

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