I'm using a third party css library for styling, but I'd like to specify a different min-height for a particular div.
The div is using themeRow class which has a number of attributes and sets:
min-height: 200px
In my case this is much too large, and i'd like to set a different value i.e
min-height: 75px
So i've defined some inline css but my value is being ruled out when rendered and the div still draws at min-height: 200px
Any way I can tell css to use my value instead of the third party value?
<style>
.bannerHeight {
min-height: 75px;
}
</style>
<div class="themeRow bannerHeight"></div>
Either apply the style="padding:0px;" on the content div inline (not recommended), or load your style after you load your external style sheet. Applying style="padding:0px;" to the body will only affect the body, and not apply to every element within it.
To override the CSS properties of a class using another class, we can use the ! important directive. In CSS, ! important means “this is important”, and the property:value pair that has this directive is always applied even if the other element has higher specificity.
So to override any CSS in an Angular project, go into styles. css and repeat the class selector until your CSS has a higher specificity than the original.
You can use !important to override the min-height: 200px value which is being assigned to your <div> by the third-party library. Try using this CSS:
<style>
.bannerHeight {
min-height: 75px !important;
}
</style>
IMHO it is better to use deeper levels over !important. If this is on your page 'main' then
<style>
.main .bannerHeight {
min-height: 75px;
}
</style>
will override
<style>
.bannerHeight {
min-height: 75px;
}
</style>
simply replace .main with whatever element is the parent to .bannerHeight, possibly just div .bannerHeight in this case as you hint. !important should be used for awkward situations where html css elements are being created dynamically, not for simple CSS overwriting as in this case.
But its your call.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With