I get why min-width
and max-width
are useful, but I stumbled across CSS code that goes like this quite a few times now:
#someDiv {
min-width: 90vw !important;
max-width: 90vw !important;
}
and I wonder what the advantage of that approach would be vs this:
#someDiv {
width: 90vw !important;
}
As far as I can tell, the effect is the same. Am I missing something here?
#parent {
width: 500px;
height: 300px;
background: aqua;
}
#widthChild {
height: 100px;
background: red;
width: 100px;
}
#minMaxChild {
height: 100px;
background: yellow;
min-width: 100px;
max-width: 100px;
}
<div id="parent">
<div id="widthChild">
width:100px
</div>
<div id="minMaxChild">
min-width: 100px;
max-width: 100px;
</div>
</div>