Live data from Hacker News

CSS is powerful, you can do a lot of things without JS

github.com

51–60 of 319 posts

Re: CSS is powerful, you can do a lot of things without JS

#52
post #27

Earlier quoted context omitted.

JS is far more predictable than CSS.

CSS ( properly written ) is easier to debug than JS.

Easier to find the bug harder to fix I think. The problem is CSS has a global scope - you change one thing and breaks the whole site's layout. With javascript usually code affects more specific areas of the site/web app.

Re: CSS is powerful, you can do a lot of things without JS

#54
Most of these are just clever CSS hacks. There is a website collecting these kind of experiments since the early '00: http://www.cssplay.co.uk/

There was a time when separation of concerns and the "Rule of Least Power"[0] where the foundation principles of web development.

Today you have preprocessors, postprocessors, transpilers, content and style in JavaScript, behavior in CSS. Very powerful tools that can easily lead to unnecessary complexity.

On the other hand, somehow W3C failed to turn these principles into a truly interoperable and semantic web.

Ah! Also, nobody cares about unobtrusive JavaScript anymore.

[0]: https://www.w3.org/2001/tag/doc/leastPower.html

Re: CSS is powerful, you can do a lot of things without JS

#56
post #42
post #19

Earlier quoted context omitted.

Fortunately you can use animation-delay to simulate bloated Javascript.

It's not about bloat, it's about accidentally triggering menus when you move your mouse down the page.

Ah! I read the parent's post as sarcastic. But you are right, a little delay can be good.

Re: CSS is powerful, you can do a lot of things without JS

#57

Numerous accessibility issues here. Many of these examples can't be operated by a keyboard, for example. "CSS only" is not a virtue if it comes at the cost (as it always does) of needlessly excluding people from the web.

Was about to write the same. The three examples I clicked on - tabs, accordion, and menu - didn't work via keyboard.

All of these are fairly simple show and hide interactions that are easier to use, build and maintain when done with javascript, with all the content shown if JS is turned off, not fully loaded or broken.

Post reply on HN