Loading...
.card {
--dx: -40px;
translate: calc(sign(var(--dx)) * 10px) 0;
}sign() returns '-1', '0' or '1', so the card moves 10px in the direction of --dx whatever its size.
sign() returns -1, 0 or 1 as a plain number.sign() instead of separate rules for each case.sign(100% - 400px).It returns 0, so anything multiplied by it becomes 0 too.
Yes. The argument can be a length or percentage, like sign(100% - 400px), but the result is always a plain number.