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
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.
A class can't inherit properties. Inheritance is done through the DOM tree from the parent element. This will only happen if the default style for an element is to inherit, or if you have explicitly said some-property: inherit;
.
If you are asking how to stop rules from CSS rulesets that have selectors which match a given element from applying, then you can use the initial value. Note that:
You'd probably be best off rewriting your stylesheet to be less broad in the elements it affects in the first place though. That approach will certainly have the best browser support.
You cannot reset css properties, you can overwrite your css properties one by one, nothing automatic so far.
* {
property:inherit
...
... long list of all .css properties ...
propertyZ:inherit
}
and maybe (wishing)) comming soon :initial
See this answer : Reset/remove CSS styles for element only
You Cant reset properties, as they will always be inherited
You can surely Override them by using !important
ex:
childselector
{
height:auto !important;
}