Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

This should also work:

div:nth-child(3n):after { content: ""; }

div:nth-child(3n):before { content: "fizz"; }

div:nth-child(5n):after { content: "buzz"; }



I retract my answer in favor of this. Clever.


I think your answer is a lot more readable, though. I have to squint at jontro's version for a while before determining that it'll actually product the string "fizzbuzz".


Brilliant.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: