Skip to content

Instantly share code, notes, and snippets.

@moonglum
Last active November 24, 2015 13:47
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save moonglum/3fc0e99622eec8729ac6 to your computer and use it in GitHub Desktop.
Save moonglum/3fc0e99622eec8729ac6 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