I found this code snippet on https://codepen.io/chriscoyier/pen/NWNJpdJ. Can someone help me modify it to change the counter on page load instead of hover? Also, I want the counter to stop at 100 without resetting back to 0.
@property --num {
syntax: "<integer>";
initial-value: 0;
inherits: false;
}
div {
transition: --num 5s;
counter-set: num var(--num);
font: 800 40px system-ui;
}
div::after {
content: counter(num);
}
div:hover {
--num: 100;
}
body {
margin: 2rem;
}
Hover the number.
<div></div>