CSS 2, precedence of stylesheets imported using link element

前端 未结 4 1081
滥情空心
滥情空心 2021-01-13 22:26

Given



<         


        
4条回答
  •  时光说笑
    2021-01-13 22:56

    According to the specs, the latest one is applied.

    4. Finally, sort by order specified: if two declarations have the same weight, origin and specificity, the latter specified wins. Declarations in imported style sheets are considered to be before any declarations in the style sheet itself.

    Anyhow, would not be good practice to rely on this alone, as it makes your code hard to read and interpret. I would make sure the correct rules were applied through specificity of the selectors, no matter what stylesheet they are placed in.

提交回复
热议问题