CSS selector for all the textboxes


Usual way of applying styles for all the textboxes is like below

input[type=”text”] {
/*CSS here*/
}

Problem with the above is, it will not include the textboxes which get renders when you simply put a <input> tag. Note that when you do not specify the type attribute in input elements, it will render as the default input element, textbox. The above CSS selector won’t work in such cases. In such cases, you can use the below

input:not([type]), input[type=”text”]
{
/*CSS here*/
}

It will select all the input control without a type attribute as well as which are marked as type=”text”

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s