I tried the following style on a div but it is saying invalid css:
max-width: calc(24rem-13px);
The calc is using rem and px combined. If I remove the px part, then browser accepts the calc as valid style.
I am using latest Chrome.
I tried the following style on a div but it is saying invalid css:
max-width: calc(24rem-13px);
The calc is using rem and px combined. If I remove the px part, then browser accepts the calc as valid style.
I am using latest Chrome.
You just need to add a space around the minus operator:
.test {
background-color: gold;
max-width: calc(24rem - 13px);
}
<div class="test">I have a max width</div>
It's not working because without the space it could be interpreted as a negative value calc(24rem - -13px)
for example