Live data from Hacker News

Idea: When (if) statements in CSS

hastebin.com

1–10 of 24 posts

Re: Idea: When (if) statements in CSS

#5
This will allow never ending loops (two of these can @when each other) - css is not an imperative language that works from top to bottom, it's more of a state language where certain items override other.

If you add this, the language will become turing complete, and then you'll have people disabling css just like they disable javascript.

If you want this, you'll need to find a syntax that makes it impossible for css to become turing complete.

Re: Idea: When (if) statements in CSS

#6

Looks cool. My one thought is replace @when with @if, to make life easier for every programmer ever.

Depends on if the OP means this should be event-driven/dynamic or not. The "when" seems to imply that it should be. When .widget becomes larger than 300px (screen resize/flip, for instance), then the font-size should become larger.

If that is OP's intention, then I feel @when is more appropriate than @if

Post reply on HN