Cancel a CSS declaration

后端 未结 8 1009
礼貌的吻别
礼貌的吻别 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:27

    Rather than trying to force a selector to inherit font colour from its grandparent, I would suggest that you give the selector and its grandparent a shared declaration for the font colour.

    Taking the blockquote example, assuming that body is the grandparent:

    body, blockquote em {
           color:[whatever];
    }
    
    
    blockquote {
           color:red;
    }
    

    And in the case of the unordered lists, it would be:

    body, ul ul {
           color:[whatever];
    }
    
    
    ul {
           color:blue;
    }
    

提交回复
热议问题