Override inline CSS from CSS file without !important
No.
The only way to override a CSS rule without using !important
is to use a more specific selector.
No selector is more specific than the style
attribute.
If we think about this differently considering that you want to override width/height then yes you can do it with min-width/min-height:
#my_component {
min-width:200px;
min-height:200px;
background:red;
}
<div id="my_component" class="class_1" style="width: 40px; height: 40px;"></div>
And to be more accurate you can add the max-* version to be sure you have a fixed height/width:
#my_component {
min-width:200px;
min-height:200px;
max-width:200px;
max-height:200px;
background:red;
}
<div id="my_component" class="class_1" style="width: 40px; height: 40px;"></div>