Live data from Hacker News

The Debate Around “Do We Even Need CSS Anymore?”

css-tricks.com

31–40 of 67 posts

Re: The Debate Around “Do We Even Need CSS Anymore?”

#31
I think CSS Modules[1] (mentioned toward the end of the article) provides a starting point to finding a good compromise. It deals with the scoping issues, as well as interoperability between Javascript modules and the defined style classes.

As it stands, the CSS Modules approach doesn't yet provide the same level of expressiveness which can be achieved with the styles-in-JS approach, but perhaps there is still value in evolving CSS-the-language to provide enough expressiveness while still providing an optimal syntax for style definition and facilitating static analysis and transformation specific to the domain of styling.

[1] https://github.com/css-modules/css-modules

Re: The Debate Around “Do We Even Need CSS Anymore?”

#32
post #19

>What is the alternative to CSS then? The alternative is inline styles. ... The idea is you apply styles to elements through JavaScript. But if you have a non-trivial app with thousands of elements across hundreds of pages, people will inevitably want to "tame", "organize", "consolidate", etc those inline styles into some coherent taxonomy to enforce consistency. Wherever and however the programmers decide to store t…

Alternatively, people could organize things using theri programming language of choice in the serverside, when they generate the HTML. No need to force an universal standard on everyone.

Re: The Debate Around “Do We Even Need CSS Anymore?”

#33
post #23

Earlier quoted context omitted.

> If a user doesn't like something about how your page is presented, they can fix it using userstyles I'm actually curious what percentage of people could do so in under an hour.

Not a huge amount of people will make custom styles, but they can be shared on sites like userscripts.org, for people who wouldn't bother making them or don't know css to use. Knowledge of basic HTML and CSS is more widespread than you might think. If you're using inline styles, you're likely to end up with a lot of elements that don't have classes or ids to target for styling, so userstylers will have to use complex…

All of this.

I resort to a set of brute force or reset stylesheets which pretty much explicitly override everything.

If you're going to use inline styles then basically fuck you.

Re: The Debate Around “Do We Even Need CSS Anymore?”

#34
Its weird because I remember when no one knew about CSS, amd then suddenly everyone had to do it. I also remember separating JS and HTML being really important for everyone for many years, but now everyone is doing the opposite. It just goes to show that people can make a cargo cult about any general approach.

Re: The Debate Around “Do We Even Need CSS Anymore?”

#36
post #27

In human history we always went through development loops. And I can tell you this: I was there when there was not much CSS, and certainly no preprocessors. CSS was the Next Big Thing on the table (not even 10 years ago, and div was the next big thing instead of table). There are reasons for CSS. Now that it's everywhere young people think it sucks. Because old code always sucks. But often it's not the technology tha…

In what universe did SQL ever go away?

The growth of popularity of non-relational databases was a reflection of the emergence of a different applications and a different approach to development.

The "hate" for SQL was indeed often misplaced, but the need for different kinds of databases was real. The schemas of SQL were powerful but sometimes cumbersome to developers who need to rapidly iterate on their applications. The relational structure of SQL is sometimes ill-suited for the sort of graph queries needed in large social networks.

SQL is sometimes the wrong tool for the job. Other times it's a powerful tool; maybe even most of the time.

In short, there probably isn't any "one-size-fits-all" solution for databases.

But the need for non-relational databases was very real; just ask Facebook, LinkedIn, or Twitter.

---

CSS is another example of a tool that's "going out of fashion" for a real reason: it was never designed for the modular, component-oriented pattern that many developers are using for complex applications on the web.

There need not be a "one-size-fits-all" solution for ALL styling on the web, but CSS is hardly ideal for web applications that are a composition of modular components.

CSS probably won't go anywhere, as it is still useful for the more page-like content that it was originally designed for, but we still need something different for modular front-end application development.

Re: The Debate Around “Do We Even Need CSS Anymore?”

#37
post #34

Its weird because I remember when no one knew about CSS, amd then suddenly everyone had to do it. I also remember separating JS and HTML being really important for everyone for many years, but now everyone is doing the opposite. It just goes to show that people can make a cargo cult about any general approach.

Separating JS and markup was important when we were imperatively mutating the DOM by hand. Writing "inline" JS is necessarily global, and therefore makes writing modular code a lot harder.

In other words, separating JS from the markup allowed us to write more modular (and therefore less error-prone) code, but was sometimes harder to think about.

Components capture the markup with the JS behavior that corresponds with it in a modular fashion; it's the best of both worlds. It really is a step forward.

Re: The Debate Around “Do We Even Need CSS Anymore?”

#39
post #38

I find it ironical that I can barely scroll this site on my omg-4-years-old smartphone. Yeah, we need more js and emulation, definitely.

On a webpage that already uses client side javascript, do you know if this would actually slow it down any real amount (more then 10ms)?

Re: The Debate Around “Do We Even Need CSS Anymore?”

#40

I'd propose the following distinction, especially for React users: If your components will only ever be used by you or a small, internal team of programmers, then inline styles can work. If, however, your components are meant to be re-usable, public and accessible then CSS is still a must. To pick on one project react-datagrid is a super useful, public component for displaying data, but they use inline styles, which…

How about if you design the styles so you can pass in a styles object via the parent element, and the style-elemnt gets merged in to overwrite the defaults? is there a reason this wouldn't work?
Post reply on HN