CSS FIzzBuzz

Orde Saunders' avatarUpdated: Published: by Orde Saunders

Knowing the answer to the FizzBuzz riddle when asked in an interview is supposedly the mark of a good programmer so here's how I'd do it in CSS.

li:nth-child(3n), li:nth-child(5n) {
  list-style-type: none;
}
li:nth-child(3n):before {
  content: "fizz";
}
li:nth-child(5n):after {
  content: "buzz";
}

But if you think CSS isn't a real programming language this answer probably doesn't count.


Comments, suggestions, corrections? Contact me via this website