HTML & CSS
Article
By Louis Lazaris

CSS is Alive and Well

By Louis Lazaris

Due to the ever-growing popularity of React, Facebook’s user interface library, there has been some discussion on the topic of CSS and whether or not it has a future in its current form — that is, in the form of declarations in a separate stylesheet that provide presentation information for a given page or section of markup.

I’m not going to rehash the conversation or the pros and cons here. For those not familiar, here are a few links you can check out:

But what I will do is provide some strong evidence that CSS is alive and well.

The developers are restless

When I read the reactions and heated debates in comment sections of articles like this one or this one, two things become clear:

  • Developers are passionate about CSS
  • Developers are not happy with some of the proposed solutions for large CSS projects

The two links in the second bullet point in the introduction above are a slide deck and video presentation by Christopher Chedeau, a developer working for Facebook on the React project. This past week was the first time I tried delving into React a little bit, thanks to this great tutorial by Shu Uesegi. After that simple introduction, the slides gave me a little more context.

Christopher addresses 7 CSS architecture problems that he believes can be solved by using JavaScript to manage and implement styles. This is the kind of thing that makes a lot of purists shudder because, with React, you’re basically writing your markup and styles in your JavaScript — something that’s usually discouraged in keeping with “separation of concerns”.

The screenshot below captures one of Christopher’s pertinent slides in this regard, outlining the 7 problems that React attempts to address:

CSS problem solved by React

Christopher makes a great case for solving CSS’s problems in JavaScript, so I highly recommend you keep an open mind and check out his slide deck (although I’ll forgive him for saying that w3schools is his favorite website for learning JavaScript!).

So it’s clear that it feels like a CSS revolution is needed and some might say it’s already under way. But it’s also clear that CSS in its current form is not going away anytime soon.

CSS tips and tricks are in high demand

If you were keeping tabs on your RSS feeds and Twitter stream in the past week or so, then you probably came across my most recent CSS article. That was one of the most enjoyable articles to write, and judging by the incredible response in the comments and on social media, I’m glad to see that it was as enjoyable for readers.

12 Little-known CSS Facts: The Sequel

Artwork by SitePoint/Natalia Balska.

The popularity of those types of articles demonstrates that developers still love CSS in its traditional form. Tweets by Ilya Grigorik, Smashing Magazine, CSS-Tricks, and others were shared and favorited hundreds of times. And the traffic to that article and its predecessor has been amazing.

The content in my articles is mostly covering stuff that’s been available in browsers for years, not just the new “CSS3” features. In fact, I intentionally tried to use as many cross-browser CSS tips as possible and the response has been overwhelming.

But this sort of thing is not unique to my article. Consider past CSS articles on other sites that have been hot in the community. Two that immediately come to mind are, not coincidentally, both by Heydon Pickering:

Readers eat that stuff up! CSS developers of all levels, and even back-end developers, are sure to enjoy that kind of content. It has a special appeal because it’s unique and it demonstrates that there is always something new to learn in CSS. I don’t know what the traffic numbers for those articles were, but I’m sure they were very high in comparison to other articles on the same sites around the same time.

--ADVERTISEMENT--

CSS books are in high demand

Last month, Lea Verou, known throughout the industry for her CSS secrets conference presentations (first and second) has written a book for O’Reilly based on her popular “secrets” premise.

CSS Secrets book by Lea Verou

Her “secrets” presentations have been a few of the most shared and popular presentations from the conference circuit over the past 5 years. No wonder she’s used that premise to spawn a book project.

As of this writing, Lea’s book is ranked in the top 3,000 books overall on Amazon (that’s all books included, not limited to web development) and it’s in the top two or three in a number of different developer-specific Amazon categories.

Again, this demonstrates that CSS in its current form is still in high demand and is not going away soon.

Similarly, here at SitePoint, we’re still pumping out lots of CSS content in the form of books and courses on SitePoint Premium (formerly Learnable). Some of the most popular titles available on SitePoint Premium are the CSS-based content. And there’s more CSS content in the works. So the demand is not slowing down.

SitePoint Premium's new CSS content

React won’t kill CSS

As Chris Coyier pointed out in his post (linked above in the intro):

Nobody is saying we don’t need styles. We still need to style things, what’s being talked about is how and where we do that.

This means that even if the industry caught on with stuff like React and we began generating our markup and styles in our JavaScript, we’re still going to need to study CSS, learn new tricks, and uncover shiny new little-known facts. We’ll just be managing them in our JavaScript instead of in separate stylesheets. A poll that Chris is currently running on CSS-Tricks also indicates that most developers don’t like what React brings to the table in terms of CSS.

CSS-Tricks poll

And it should also be noted that there’s a lot of important stuff that React doesn’t handle well. So we have a long way to go before we hang up our .css files and move everything into our scripts.

Final thoughts

Part of the popularity of CSS is the fact that it’s easy to learn but hard to master. When CSS becomes intermingled with JavaScript, the “easy to learn” part starts to disappear. For that reason alone, I think we’ll always have traditional stylesheets. But some front-end engineers might simply choose to use more advanced options to deal with the challenges that Christopher Chedeau attempts to tackle in his slides.

That’s my current and probably somewhat ignorant view, based on some of the things I’ve been observing over the past week. What do you think? Can traditional CSS coexist with React-like implementations? Or is React’s current model just a fad that will likely evolve to something more in line with what we’re used to? Let me know your thoughts.

Recommended
Sponsors
The most important and interesting stories in tech. Straight to your inbox, daily. Get Versioning.
Login or Create Account to Comment
Login Create Account