Cancel a CSS declaration

后端 未结 8 1110
礼貌的吻别
礼貌的吻别 2021-02-07 08:47

Is it possible to have a CSS rule which basically \"undoes\" a prior rule?

An example:

some text more text ot
8条回答
  •  春和景丽
    2021-02-07 09:25

    If you can change your html you could try

  • This text should be BLUE
    • Same as outside the UL
    • Same as outside the UL
  • and the style

    li span{
        color: blue;
    }
    

    EDIT another way to accomplish this without the extra span tag:

    If we assume that we have a style class (or any other selector) that defines to parent of the outer ul. We can modify the css like this:

    .parentStyle,
    .parentStyle li li{
         color:red;
    }
    li{
         color:blue;
    }
    

提交回复
热议问题