css - min/max width/height with multiple values -
i want limit width of <div>
no more 50%
, and no more 200px
.
which means, when 50%
less 200px
, should have same behavior max-width: 50%
, otherwise behavior becomes max-width: 200px
.
how can define css?
(without min
function, have not been supported yet)
<div class="some_element">text here</div> <style> .some_element { background: red; float: left; width: auto; max-width: 200px; max-width: 50%; /* override previous one, want both of them work */ } </style>
you cannot set max-width both 200px , 50%. put element in element max-width of 400px:
<div id="parent"> <div id="child">text here</div> </div> #parent { background-color: red; max-width: 400px; } #child { background-color: green; max-width: 50%; }
Comments
Post a Comment