fkoessler
fkoessler

Reputation: 7257

CSS selector priority

Why does the css selector

select, textarea, input[type="text"], input[type="password"],input[type="datetime"], input[type="datetime-local"], input[type="date"], input[type="month"], input[type="time"], input[type="week"], input[type="number"], input[type="email"], input[type="url"], input[type="search"], input[type="tel"], input[type="color"], .uneditable-input

take precedence over

input.text-style

for the following html:

<input type="text" required="required" name="poemDataCollector[name]" id="poemDataCollector_name" class="text-style">

I read that class should have priority over html tags...

Upvotes: 0

Views: 1143

Answers (1)

sandeep
sandeep

Reputation: 92803

Attribute selectors are equally specific to class selectors.

if you want to override the class your can write like this:

input.text-style[type="text"]

Check this decision for more What is the specificity of the attribute selector?

Read this http://www.w3.org/TR/selectors/#specificity

Upvotes: 4

Related Questions