li:nth-child(3n), li:nth-child(5n) { list-style: none }
li:nth-child(3n)::before { content: "Fizz" }
li:nth-child(5n)::after { content: "Buzz" }
Example: https://susam.net/code/web/css-fizz-buzz-ol.html $ curl -sS https://susam.net/code/web/css-fizz-buzz-ol.html | sed -n '/none/,/after/p' | tr -d '[:space:]'
li:nth-child(3n),li:nth-child(5n){list-style:none}li:nth-child(3n)::before{content:"Fizz"}li:nth-child(5n)::after{content:"Buzz"}
$ curl -sS https://susam.net/code/web/css-fizz-buzz-ol.html | sed -n '/none/,/after/p' | tr -d '[:space:]' | wc -c
129
But I don't quite like how misaligned the numbers and the words look in this version. Correcting that would call for extra code that would cancel out the bytes saved. list-style-position: inside;I mean, the solution in the original post is 152 characters long.
The <ol> based solution is 129 characters long. Shorter but uglier.
If we add your correction, we get neater output but at the cost of 30 additional characters in the minified code thereby making the solution 159 characters long.
li { list-style-position: inside }
li:nth-child(3n), li:nth-child(5n) { list-style: none }
li:nth-child(3n)::before { content: "Fizz" }
li:nth-child(5n)::after { content: "Buzz" }
kevinsync•49m ago