CSS !important not working

前端 未结 2 2045
梦如初夏
梦如初夏 2020-12-18 17:49

I have the following code and for some reason the !important qualifier isn\'t working.

2条回答
  •  不思量自难忘°
    2020-12-18 18:24

    A good subject to read up on is CSS Specificity

    1. p has a specificity of 1 (1 HTML selector)
    2. div p has a specificity of 2 (2 HTML selectors, 1+1)
    3. .tree has a specificity of 10 (1 class selector)
    4. div p.tree has a specificity of 12 (2 HTML selectors + a class selector, 1+1+10)
    5. #baobab has a specificity of 100 (1 id selector)
    6. body #content .alternative p has a specificity of 112 (HTML selector + id selector + class selector + HTML selector, 1+100+10+1)

提交回复
热议问题