I have the following code (codepen)
/******* NO ACCESS ********************/
.container {border: 1px solid green;}
.container > div {border: 1px solid red;}
.container .header {max-width: 50%;}
/**************************************/
.container.reset-header .header {max-width: auto;}
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.1.3/css/bootstrap.min.css" rel="stylesheet"/>
<div class="container">
<div class="col-4 picture">col-4</div>
<div class="col-4 header">col-4 modified to 50%</div>
</div>
<div class="container reset-header">
<div class="col-4 picture">col-4</div>
<div class="col-4 header">should be reset to col-4</div>
</div>
I have no acces to modify the inaccesible css, but I would like to reset the col-4 width with a “reset” class. I tried auto
, uset
or inherit
, any of them didn’t gave me the 33,33%
– as the col-4
(or any other html attribute set in the code)
.container.reset-header .header {max-width: auto; }
.container.reset-header .header {max-width: unset; }
.container.reset-header .header {max-width: inherit;}
but it didn’t help
4
Answers
I think what you’re looking for is
max-width:inherit;
You can use the same value of
col-4
to reset the max-width.Something like this work well:
Edit:
What do you think about this solution, it’s little bit tricky but visually you will have the correct rendering:
auto
is not a valid value formax-width
You can take
100%
orinherit
Option 1
With this you’d be able to clear all CSS code you’re trying to use to override max-width.
I hope this helps