Skip to content

Instantly share code, notes, and snippets.

@andrew8088
Last active July 5, 2022 13:59
Show Gist options
  • Save andrew8088/2769279183948faa6433168a296e87af to your computer and use it in GitHub Desktop.
Save andrew8088/2769279183948faa6433168a296e87af to your computer and use it in GitHub Desktop.
FizzBuzz in CSS! Meant to style a bunch of sibling <div>s.
div {
counter-increment: fizzbuzz;
}
div::before {
content: counter(fizzbuzz);
}
div:nth-of-type(3n)::before {
content: 'fizz';
}
div:nth-of-type(5n)::before {
content: 'buzz';
}
div:nth-of-type(15n)::before {
content: 'fizzbuzz';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment