So I've been trying to make a web-app and thought it would be cool to have "cards" with randomized top padding.
Here's a screen-shot of what I'm trying to achieve:
And here's what I have:
This is the JavaScript I tried to use, but it failed.
document.getElementById("card").addEventListener("load", randomCards);
let root = document.card;
function randomCards() {
root.style.setProperty('cardpadding-top', Math.floor(Math.random() * 6) + "px");
});
And here's the HTML:
<body>
<div class="scroll-wrap">
<div id="card"></div>
<div id="card"></div>
<div id="card"></div>
<div id="card"></div>
<div id="card"></div>
</div>
</body>
Any help is appreciated :)