MDN self-hosted library · e01.org

`abs()` CSS function

Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.

css
/* abs( <calc-sum> ) */
abs(20% - 100px)
abs(var(--gradientAngle))
css
h1 {
  font-size: abs(var(--font-size));
}
css
div {
  --deg: -45deg;
  background-image: linear-gradient(abs(var(--deg)), blue, red);
}
css
p {
  line-height: max(var(--lh), -1 * var(--lh));
}