Live data from Hacker News

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

github.com

101–110 of 319 posts

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

#101
Traditionally, I remember the rule that presentation should be managed by css, while behavior should be managed by javascript. But does the fact that some things can be reasonably done either way change - for example - a site's or app's maintainability? How about it performance? Is a CSS implementation rendered faster than javascript? I struggle with this at times, especially in some cases where - admittedly older - frameworks allowed for some overlap. Ah, well, much like lots of the web, i'll just work to get stuff done.

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

#102

Is it possible to display a "There are no records" message if a container is empty (i.e. tbody) using CSS only?

There is an :empty state you can use. I'm not looking at the demo right now but I've added messages like this:

    .container:empty:before {
      content: 'There are no Messages'
    }

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

#104
post #95

Earlier quoted context omitted.

Mozilla (including Firefox) had XUL, but nobody cared.

Was it ever meant for general web usage?

For a time that was talked about (and Firefox supported XUL-based sites up to version 4).

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

#105

Earlier quoted context omitted.

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.

I experiment with scoped CSS - where styles and even responsive conditions are tied to a specific element on the page and not the page as a whole.

This means you I'm able to retrofit old sites with new code with zero fear that the code I'm adding can affect anything else previously on the site :) It's also handy when building new stuff too.

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

#106

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…

The W3C's job is to standardize implementations. Most standards bodies do not invent on their own. In any case, a standards body will generate the fundamentals allowing the ability to piece together components to create what a developer wants. No standards body is able to come up with every desire of every developer.

The point is: Usually, you must know the rules to break them. In this particular context, looks like the original rules are fading away.

No rules = Anarchy.

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

#107

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…

What do you exactly mean with "remote-execution-by-default"? As far as I know, all browsers have strict "same-origin" policies by default.

> What do you exactly mean with "remote-execution-by-default"? As far as I know, all browsers have strict "same-origin" policies by default.

Even with the same-origin policy, the default behaviour of a web browser is to execute code it downloads from a remote site (i.e., remote to your computer); as it turns out, this is an utter disaster for security and privacy, turning what is a relatively securable platform (HTML+CSS) into a nightmare.

It is not, today, possible to be secure and private while allowing JavaScript. That's a problem.

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

#108
IMHO this is a big step back, what do you really gain by sacrificing semantics just to avoid a little js code? CSS was supposed to help us separate content and presentation, and adding a bunch of unneeded tags just to make these hacks work is the very opposite of that.

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

#109
post #92
post #81

Earlier quoted context omitted.

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

Remember when Good Developers would hate on framesets because they break the back button and linking and everything? Now it's totally OK to break all that with AJAX and "text-as-apps"... I much prefer the days of the old web.

Days of the old web where flash was pervasive and best viewed in [IE6|Netscape|Mosaic|...] pages were everywhere. Every generation of the web has had really crappy devs building bad experiences. The current generation is not making anything worse than it's predecessor.
Post reply on HN