I just read up on the CSS function calc()
in Mozilla's Developer Network.
The first example in this article uses the following CSS code:
.banner {
position: absolute;
left: calc(40px);
width: calc(100% - 80px);
border: solid black 1px;
box-shadow: 1px 2px;
background-color: yellow;
padding: 6px;
text-align: center;
box-sizing: border-box;
}
And this HTML markup:
<div class="banner">This is a banner!</div>
Pardon me, if this is an overly trivial question, but is there any reason to use left: calc(40px)
or is that simply a mistake? Since there is nothing to compute, I'd just put left: 40px;
.
calc
based fallback properties too. Looks like it dates from then, so the fixed40px
would match with the actualcalc
property, ie it's either based on percentages or px based calculations depending on what the browser supports. – Pistolleft: 40px;
andright: 40px;
for the same result. – Stellitecalc()
can - theoretically - be used like this, even if it has little relevance in practice. – Fern