Skip to content

Instantly share code, notes, and snippets.

@jeremydw
Created October 28, 2013 19:32
Show Gist options
  • Save jeremydw/7203097 to your computer and use it in GitHub Desktop.
Save jeremydw/7203097 to your computer and use it in GitHub Desktop.
FizzBuzz in CSS
<!doctype html>
<title>FizzBuzz in CSS</title>
<meta charset='utf-8'>
<style>
ul {
counter-reset: number;
}
li:before {
counter-increment: number;
content: counter(number);
}
li:nth-child(3n):before {
content: 'Fizz';
}
li:nth-child(5n):before {
content: 'Buzz';
}
li:nth-child(3n):nth-child(5n):before {
content: 'FizzBuzz';
}
</style>
<ul>
<li>
<li>
<li>
<li>
<li>
<li>
<li>
<li>
<li>
<li>
<li>
<li>
<li>
<li>
<li>
<li>
<li>
<li>
<li>
<li>
<li>
<li>
<li>
<li>
<li>
<li>
<li>
<li>
<li>
<li>
</ul>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment