Is it possible to reset all inherited CSS propeties?

后端 未结 4 914
一个人的身影
一个人的身影 2021-01-19 05:28

How do you reset ALL inherited properties for a class in a CSS file? I need to be able to set new properties on elements without pre-defined properties having an effect on i

4条回答
  •  日久生厌
    2021-01-19 06:06

    Simple answer - you can't.

    Unless you override ALL the properties with something more specific, you cannot do this efficiently. This is extremely redundant, and I don't suggest doing it.

    Instead you should avoid this completely. Don't set properties in the first place and you won't have this problem.

    Also, don't do what other are suggesting and use !important this is a bad practice.

提交回复
热议问题