0

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...

3
  • It's called specificity value, I've posted a good answer on it once, let me find it Commented Jul 11, 2012 at 6:53
  • stackoverflow.com/a/10557730/871050 Here you go Commented Jul 11, 2012 at 6:55
  • Your first selector should only take precedence if it is declared after your second selector. Commented Jul 11, 2012 at 6:56

1 Answer 1

4

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.