Skip to content

Instantly share code, notes, and snippets.

@nchapon
Created November 30, 2015 22:01
Show Gist options
  • Save nchapon/09cb1c8b6c77bdba55f2 to your computer and use it in GitHub Desktop.
Save nchapon/09cb1c8b6c77bdba55f2 to your computer and use it in GitHub Desktop.
FizzBuzz in html
<!doctype html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>FizzBuzz en HTML</title>
</head>
<body>
<div>
<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>
<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