Skip to content

Instantly share code, notes, and snippets.

@mattkenefick
Last active November 6, 2023 14:40
Show Gist options
  • Save mattkenefick/5cd0fba756e58d82f82ccf7d77f5c861 to your computer and use it in GitHub Desktop.
Save mattkenefick/5cd0fba756e58d82f82ccf7d77f5c861 to your computer and use it in GitHub Desktop.
Ultra Generic Website Starter Kit
<!DOCTYPE html>
<html>
<head>
<style>
body {
background: black;
color: white;
font-family: sans-serif;
}
p {
display: block;
font-size: 2.5rem;
margin: 0;
overflow: hidden;
position: relative;
}
p > span {
display: block;
transition: transform 0.5s ease-in-out;
}
p:not(.state-animate-in) span {
transform: translate(0, 100%);
}
</style>
</head>
<body>
<section>
<p>Wow,</p>
<p>I'm just like every other</p>
<p>website on the internet now.</p>
</section>
<script>
const paragraphs = [...document.querySelectorAll('p')];
paragraphs.forEach(paragraphRef => {
const spanRef = document.createElement('span');
spanRef.innerHTML = paragraphRef.innerHTML;
paragraphRef.innerHTML = '';
paragraphRef.appendChild(spanRef);
});
paragraphs.forEach((paragraphRef, index) => {
setTimeout(() => {
paragraphRef.classList.add('state-animate-in');
}, 150 * index);
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment