undefinedfix
Sign in

Why doesn't this CSS class work?

dbaser edited in Sun, 04 Dec 2022

20200303_211317.png

The address is at https://ethsonliu.com/ I didn't find any other color to cover it.

5 Replies
qjnnp
commented on Sun, 04 Dec 2022

? It's not obvious in your screenshot that the style of header container a covers it, and the child element selector has higher priority than the class selector

ninji
commented on Mon, 05 Dec 2022
#header-container a{
    color: rgb(51, 51, 51)
}

The weight of ID is greater than that of class

Martin
commented on Mon, 05 Dec 2022

The weight of the ID selector is higher than that of the class selector.


Attached:
  • CSS selector weight calculation chart
Lars
commented on Mon, 05 Dec 2022

Priority relation: important > inline style > ID selector > class selector = attribute selector = pseudo class selector > label selector = pseudo element selector

ecisse
commented on Mon, 05 Dec 2022

Weight problem ha, ID weight is greater than class weight important > inline style > ID selector > class selector, try not to use ID to write style ha, nothing wrong also don't declare ID