This content originally appeared on Manuel Matuzović - Web development blog and was authored by Manuel Matuzović
You can use full math expressions in the comparison functions min(), max(), and clamp(). There’s no need to nest a calc() function inside.
Writing…
div {
border: max(20px, calc(1vw + 10px)) solid;
}
…is the same as writing…
div {
border: max(20px, 1vw + 10px) solid;
}
You can also use custom properties.
.var {
--extra: 10px;
border-width: max(20px, 1vw + var(--extra));
}
Complex expressions are also possible.
div {
width: clamp(50px * 4 * 1.5, (100% / 2) * 2, 400px * 2);
}
This content originally appeared on Manuel Matuzović - Web development blog and was authored by Manuel Matuzović
Manuel Matuzović | Sciencx (2022-11-09T09:38:54+00:00) Day 33: Mathematical expressions in min(), max(), clamp(). Retrieved from https://www.scien.cx/2022/11/09/day-33-mathematical-expressions-in-min-max-clamp/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.