Skip to content

Instantly share code, notes, and snippets.

@timoschilling
Forked from moonglum/fizzbuzz.html
Created November 24, 2015 11:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save timoschilling/ee5b9cd50ae8bc15e216 to your computer and use it in GitHub Desktop.
Save timoschilling/ee5b9cd50ae8bc15e216 to your computer and use it in GitHub Desktop.
This is a FizzBuzz Solution I found on Twitter. It was always shared as a screenshot, so I typed it myself, to try it out ;) Source: https://twitter.com/ericwastl/status/667567483432402944
<html>
<head>
<style>
body {
counter-reset: n;
}
div:before {
counter-increment: n;
content: counter(n);
}
div:nth-child(3n):before {
content: "fizz";
}
div:nth-child(5n):before {
content: "buzz";
}
div:nth-child(3n):nth-child(5n):before {
content: "fizzbuzz";
}
</style>
</head>
<body>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment