Live data from Hacker News

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

github.com

81–90 of 319 posts

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

#81

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 l…

Hmmm...

    .accordion .content {
        padding:0 10px;
        overflow:hidden;
        border:1px solid #fff;
        -webkit-transition: all .5s ease-out;
        -moz-transition: all .5s ease-out;
    }
-webkit-transition, -moz-transition... it's like we're at 180 degrees to where the web was in the days of IE4-6

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

#82
post #66

Earlier quoted context omitted.

What's the point of this post?

There are HN guidelines, and there's also the English grammar with a plethora of tools to help those with a mother tongue different than English like myself. HN is not a chatroom - it's a news website.

You are missing semicolons in there.

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

#84
post #78

Earlier quoted context omitted.

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.

If you properly modularize your CSS the global scope no longer remains a concern.

the thing is that we don't always start working on sites from scratch. more often I have to clean up someone else's mess or my own that I made months or years ago. in that case I'd rather debug javascript than css.

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

#86
I am missing one important argument in this discussion:

CSS only design is an important piece of a future web with reduced security and privacy threads.

The (interesting) model of allowing remote code execution per default was a beautiful, but naive vision. We have to make big advances in technology, politics and society to make this model work in a way that does not make internet users victims by default. We are not there yet. Reality is: the crooks destroyed that vision and are advantaged by the current situation, while all internet users are being trapped in their first moment of browser usage without their consent or knowledge.

For many use cases, (e.g. government websites, banking, anything where you type in your name) css-only design should become a requirement by law to protect the user until we figured out how to write secure software that respects user privacy and how to form governments that will respect their citizens (possibly will take longer). Until then browser vendors should implement more and better possibilities for CSS that help to avoid JavaScript whenever possible.

I very much like JS animations and stuff happening in the browser window, also there are some edge cases where JS brings some important advancements to a UI, but we have to face that privacy and security are much more important issues than having a nice UI and we have to change the current situation, as we, as programmers, are responsible for it.

The "remote-execution-by-default" experiment has failed, we need to change that, and CSS is a great way to go on with a web that might be less problematic for everyone, but still offers very nice usage experiences.

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

#87
post #81

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 l…

Hmmm... .accordion .content { padding:0 10px; overflow:hidden; border:1px solid #fff; -webkit-transition: all .5s ease-out; -moz-transition: all .5s ease-out; } -webkit-transition, -moz-transition... it's like we're at 180 degrees to where the web was in the days of IE4-6

transition has been standardized and available in all browsers for years already, that is only necessary as fallback for very old browsers.

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

#88

Earlier quoted context omitted.

I write a lot of CSS and I would probably disagree. CSS has no console.log() for debugging, CSS often fails silently, and the demos in the link are more or less (albeit pretty neat) hacks, but don't use CSS features in the way the specifications intended.

My reasoning is that CSS is not a language, it's just a configuration file. It doesn't have a console.log, but it has `background: red`. JS as a language and as such ( especially it's callback / event-driven nature ) makes it harder to debug.

Yes, but with the browser debugger you can step through the JS code and visualize what it is doing. How can you visualize what is happening with CSS, short of debugging the internal browser code ?

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

#90
post #56

Earlier quoted context omitted.

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

There's a lot more to this than just "a little delay" to avoid accidental triggers. Good menus are complex. In desktop toolkits, there is a lot of logic to ensure they are accessible and don't behave in annoying ways. For example, a high quality menu will have a certain leeway to trigger into and out of submenus so that you don't accidentally drift into the incorrect submenu should you make an error of a couple of pi…

> 0.001% that doesn't use JS

https://gds.blog.gov.uk/2013/10/21/how-many-people-are-missi...

1.1% of users don't see JavaScript enhancements. Most because it doesn't load, not because they've disabled it. Also, some people use browsers that don't support JavaScript, or their ISP filters JavaScript, or a whole bunch of other things.

I'm not endorsing making menus in CSS. I'm just saying that it isn't "accessibility vs. people who turn JS off".

As the link says: progressive enhancement is the solution to this.

Post reply on HN