Bert Bos | CSS tutorial – values
Values and units
initial
and inherit
calc(...)
– expressions
toggle(...)
– not the
inherited value
attr(...)
– copy the value of an
attribute
inherit
(Level-2 feature)
a:visited {color: inherit}
The color of the parent, whatever it is
initial
From the demo:
div.back { font-size: initial }
(In fact, for 'font-size' there are two other ways to achieve the same: 'medium' and '1rem'.)
calc()
For calculations ( + - * / ) that depend on the current rendering.
From the demo:
p.boxed {border: solid 2px; padding: calc(0.6em - 2px) calc(1em - 2px);
Reduce the padding by the thinkness of the border
„+” and „-” must have spaces on both sides
Only values of the same type can be added:
calc(1em + 2s)
is wrong
Division (/) only by numbers: calc(100% /
10em)
is wrong
Division by 0 is evidently not possible
cm, mm, in en pt are unfortunately no longer useful on screen media. So far there is no replacement.