Solving FizzBuzz with CSS(dabblet.com)
dabblet.com
Solving FizzBuzz with CSS
http://dabblet.com/gist/2628265
29 comments
Correct, you don't need the :nots as long as the CSS is in that order, since the :after content would be overridden correctly. You would need them if you changed the order of the statements.
I started the experiment using background color instead of "fizz", border color instead of "buzz", and box-shadow instead of "fizzbuzz" which necessitated the need for :nots since the properties weren't overriding.
I started the experiment using background color instead of "fizz", border color instead of "buzz", and box-shadow instead of "fizzbuzz" which necessitated the need for :nots since the properties weren't overriding.
This should also work:
div:nth-child(3n):after { content: ""; }
div:nth-child(3n):before { content: "fizz"; }
div:nth-child(5n):after { content: "buzz"; }
div:nth-child(3n):after { content: ""; }
div:nth-child(3n):before { content: "fizz"; }
div:nth-child(5n):after { content: "buzz"; }
Heh... how this looks in IE 8: http://i.stack.imgur.com/Fz3jT.png
To be fair, IE8 was released on March 2009 (according to wiki), Chrome at that time was v1.0 and Firefox was v3.0.
Usually IE8 users are stuck in IE8 unless they let the OS upgrade their browser, so most of the users that started with IE8 are still stuck in 2009. Chrome/FF users tend to have less issues with upgrades.
Not to mention those of us in a workplace still using XP (and thus unable to upgrade past IE8).
All horrible arguments. "Stuck?" Download a real browser.
IE8 viewers expect devs to slow progress or cater to them would be like horse and buggy drivers from days of yore lobbying to prevent cars from going faster than horses.
Stop complaining, get off your horse and get a (free) car. Encourage your clients to do likewise.
IE8 viewers expect devs to slow progress or cater to them would be like horse and buggy drivers from days of yore lobbying to prevent cars from going faster than horses.
Stop complaining, get off your horse and get a (free) car. Encourage your clients to do likewise.
Corporate environments sometimes lock down their computers completely, and don't give admin/install privileges, let alone OS updates.
So yes, "stuck".
So yes, "stuck".
No rest until CSS is Turing complete.
You mean like this CSS-implementation of Rule 110?
http://eli.fox-epste.in/rule110-full.html
For those who tried this in Chrome, like me, it won't work :(
Try it in Firefox instead.
Try it in Firefox instead.
Goes to show how many (greatly needed) programmatic features CSS is adding. Also shows that some people love a creative way to attack a problem.
As God is my witness, CSS will need to be split into a presentation language and a logic language. /s
You know, that’s not such an outlandish claim. CSS is accumulating features that seem to me completely out of place in a styling language. Then again, HTML isn’t perfect, nor JavaScript, nor PHP or any language—but we still get stuff done with them, so who am I to complain?
[deleted]
Goes to show what a hack-riddled mess Web presentation still is.
Is this some regional drinking game? Like Three-Man?
[deleted]
The cascade of the CSS will take care of the cases the div is a 'fizzbuzz'.
Sorry I can't post the example, Dabblet is working strangely for me this morning.
CSS that should work: