I have a css file with this style:
.filefield-element .widget-edit {max-width: 70%;}
I wanted to increase the max-width without modifying that css file, so I created a custom css file with this style:
.filefield-element .widget-edit {max-width: 99%;}
In the "html/styles" pane, I see that the styles are listed in the correct order:
.filefield-element .widget-edit { max-width: 99%; } .filefield-element .widget-edit { float: left; max-width: 70%; }
However, "max-width: 99%" is not overriding "max-width: 70%". It seems that the more restrictive value (70%) is used, even when the less-restrictive value (99%) comes first.
Is there a way to override a max-width value with a larger (less restrictive) value?
The max-width property in CSS is used to set the maximum width of a specified element. The max-width property overrides the width property, but min-width will always override max-width whether followed before or after width in your declaration.
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.
Change the maximum width. max-width overrides width , but min-width overrides max-width .
The CSS max-width property is used to set the maximum width of an element.
You can override (unset) max-width with
.foo{ max-width:none; }
... to clear any inherited max-width.
Try using !important
, or selector with higher specificity.
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