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.
Yes! However, like I mentioned in my previous comment, corrections like this cancel out the number of bytes saved with the <ol>-based solution.
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, which is nice, but it comes at the cost of 30 additional characters in the minified code thereby making the solution 159 characters long.
I love this, it's a very clever and funny way to solve the problem. Makes me think about how there are infinite routes from A to B, some more scenic and whimsical than others.. as well as all the people I've met along the way who would be so pissed and pedantic about how this isn't a "real solution" LOL
The problem is that you have to define the problem enough to avoid the fact that it's trivial to output the string "1,2,Fizz,4,Buzz,6,......" and fulfill the assignment. You can, in fact, output "$1,$2,Fizz,$4,Buzz,$6..." where $ is any prefix itself divisible by 15 (there are other templates for the other situations) but it clearly does repeat endlessly.
Ignoring the size of the HTML in addition to the CSS, it’s fun, but not really fair when talking about code golf. Beyond a few numbers, you need to include some JavaScript and generating a million list elements. But those bytes count …
A shorter solution is possible with an ordered list (<ol>) if we're willing to ignore the untidy output:
Example: https://susam.net/code/web/css-fizz-buzz-ol.html 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.Yes! However, like I mentioned in my previous comment, corrections like this cancel out the number of bytes saved with the <ol>-based solution.
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, which is nice, but it comes at the cost of 30 additional characters in the minified code thereby making the solution 159 characters long.
I love this, it's a very clever and funny way to solve the problem. Makes me think about how there are infinite routes from A to B, some more scenic and whimsical than others.. as well as all the people I've met along the way who would be so pissed and pedantic about how this isn't a "real solution" LOL
The problem is that you have to define the problem enough to avoid the fact that it's trivial to output the string "1,2,Fizz,4,Buzz,6,......" and fulfill the assignment. You can, in fact, output "$1,$2,Fizz,$4,Buzz,$6..." where $ is any prefix itself divisible by 15 (there are other templates for the other situations) but it clearly does repeat endlessly.
Ignoring the size of the HTML in addition to the CSS, it’s fun, but not really fair when talking about code golf. Beyond a few numbers, you need to include some JavaScript and generating a million list elements. But those bytes count …