I noticed that when using different methods to access the HTML element in the CSS, some selectors win over others.
Suppose in an empty HTML document there is a paragraph that has been assigned the class someclass
.
The p: first-class pseudo- selector will be stronger than the .someclass class selector .
Now let's replace the class someclass
with id.
The p: first-class pseudo- selector will be weaker than the id #someclass selector.
I would like to understand the logic of these priorities.
Is there any reference book, maybe a table, clearly demonstrating the priorities of some selectors over others?
(it seems that I came across a similar table of priorities for arithmetic and bitwise operations when I was learning javascript)