Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to reset all inherited CSS propeties?

Tags:

html

css

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 it.

Is this possible using only CSS?

I am not talking about a CSS reset, such as:

body {
    margin:0px;
    padding:0px;
}
like image 445
Dmitry Avatar asked Feb 15 '23 06:02

Dmitry


1 Answers

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.

like image 77
Josh Crozier Avatar answered Mar 07 '23 02:03

Josh Crozier