<p id="rule">
The first rule of fight club is: you do not talk about fight club.
</p>
@font-face {
font-family: "Raleway";
src: url("Raleway-Black.woff2");
font-display: block;
}
*,
*::after,
*::before {
box-sizing: border-box;
}
:root {
--text-color: #ff4dd2;
--bg-color: #00ffcc;
}
body {
background-color: var(--bg-color);
font-family: "Raleway", sans-serif;
display: grid;
place-items: center;
margin: 0;
padding-inline: 0.25rem;
height: 100dvh;
}
#rule {
font-size: clamp(1.75rem, 8vw + 0rem, 4rem);
max-width: 800px;
color: var(--text-color);
text-align: justify;
text-transform: uppercase;
border: 0.2em solid var(--text-color);
border-radius: 5px;
padding: 1em;
}
span:nth-child(n + 5):nth-child(-n + 6),
span:nth-child(n + 13):nth-child(-n + 14) {
position: relative;
}
span:nth-child(n + 5):nth-child(-n + 6)::after,
span:nth-child(n + 13):nth-child(-n + 14)::after {
content: "";
display: inline-block;
position: absolute;
top: 0;
left: 0;
width: 0;
height: 100%;
opacity: 0.85;
background: var(--bg-color);
animation: strike 2s linear 0.2s 1 normal forwards;
}
@keyframes strike {
to {
width: 110%;
}
}
let words = window.rule.innerText.split(" ");
let newHTML = ``;
words.forEach((word) => {
newHTML += `<span>${word}</span> `;
});
window.rule.innerHTML = newHTML;
Obey Tyler