Cancel a CSS declaration

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

    Ok, the additional text with example clarifies the question a lot. And I'm affraid that what you want is not possible.

    If you know the "unknown colour" you can of course repeat the color. But I think CSS needs some mechanism to add variables or references.

    So you have to stick to the cumbersome:

    ul {
      color: blue;
    }
    li ul {
      color: sameenvironment;  /* Sorry but you have to add the specific colour here */
    }
    

提交回复
热议问题