Alexey Noir2018-09-15 12:17:36
Alexey Noir, 2018-09-15 12:17:36

4 questions about author style priorities and specificity?

I'm learning the basics of CSS, I'm stuck on priorities / specificity, the information on the Web is crumpled and incomprehensible.
Question 1: Hypothetically, if I assign 1001 selectors to a tag (=1001 points), will it take precedence over the style attribute (=1000 points)?
Question 2: Do styles set in the "head" block take precedence over the style attribute and !impornant ?
Question 3: Does the style from the external file take precedence over the style in "head"?
Question 4: do inherited styles have the highest priority?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A person from Kazakhstan, 2018-09-15

Styles within the tag take precedence Styles <p style="color:red;"></p>
in the head take precedence over individual styles in the style.css file but styles in the tag will override styles in the head
Inherited styles - opacity and the like cannot be overridden but can trick the browser

Alexander Alekseev, 2018-09-15

1) no, it won’t) somehow fooled around at work and checked it) there was even an idea that these are 8-bit values ​​​​and 256 classes will defeat ID, but no =)
2) important in the style attribute will not kill anything) don’t do this ever
3) no , the weakest file, then the tag

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question