Beispiel:CSS-custom-props-4.html
Aus SELFHTML-Wiki
<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" media="screen" href="./Beispiel:SELFHTML-Beispiel-Grundlayout.css" />
<title>Timer mit custom properties</title>
<style>
.time-bar div {
height: 1em;
background: linear-gradient(to bottom, #ffebe6, #c32e04);
animation: roundtime calc(var(--duration) * 1s) steps(var(--duration)) forwards;
transform-origin: left center;
}
@keyframes roundtime {
to {
/* More performant than animating `width` */
transform: scaleX(0);
}
}
</style>
</head>
<body>
<h1>Timer mit custom properties</h1>
<div class="time-bar" style="--duration: 9;">
<div></div>
</div>
</body>
</html>