Avoid using the !important
declaration in your standard stylesheets as it is considered a bad habit that disrupts the cascading nature of the stylesheets.
Instead, opt for a more specific selector to override previous styles effectively.
To reset styles back to default, make use of auto|inherit|0
depending on the attribute. For example, for min-height
, set it to 0
. CSS3 also introduces the special value initial
which is recommended, though it has limited IE support.
In the scenario where you need to set min-height:100px;
, using a selector with higher specificity (such as ID or inline style - preferably not the latter) should solve the issue.
let div = document.querySelector("#morespecific");
div.innerHTML = "This div has its min-height set to: "+window.getComputedStyle(div).minHeight;
.someclass{
min-height:200px;
border:1px solid red;
}
#morespecific{
min-height:100px;
border-color:blue;
}
<div id="morespecific" class="someclass">
-- content --
</div>