It’s Time to Fall in Love With CSS (Again)

This ad is not shown to multipass and full ticket holders
React Summit US
React Summit US 2026
November 17 - 20, 2026
New York, US & Online
Upcoming event
React Summit US 2026
React Summit US 2026
November 17 - 20, 2026. New York, US & Online
Bookmark
Rate this content
Sentry
Promoted
Code breaks, fix it faster

Crashes, slowdowns, regressions in prod. Seer by Sentry unifies traces, replays, errors, profiles to find root causes fast.

Get started

In a world of components written in JavaScript, CSS became a second-class citizen. But forget the memes. In this talk Tony shows how modern CSS can be a JavaScript developers best friend, saving coding time, and avoiding the kinds of styling problems that use to plague JS devs and have resulted in a myriad of competing CSS abstractions, which may not be so necessary any more.

This talk has been presented at JSNation US 2024, check out the latest edition of this JavaScript Conference.

FAQ

Tony Alisea is a developer with over 25 years of experience who has taught over 350,000 students web fundamentals through his courses on Udemy, Pluralsight, and Teachable. He also shares content on his YouTube channel and offers resources at TonyAlisea.dev.

You can find Tony Alisea's courses and resources at TonyAlisea.dev and help for your development team at TheSmithGroup.com.

The 'It's Time to Fall in Love with CSS' course explores the evolution of CSS, its strengths, and how modern developers can leverage new CSS features to enhance component-based development.

CSS became popular because it allowed the separation of structure and presentation, supported cascading style sheets, and offered powerful selectors for styling the entire DOM efficiently.

JavaScript developers moved away from CSS due to the shift towards component-based development, which posed challenges with CSS's cascade and selector rules when components were relocated within the DOM.

Modern CSS features that support componentization include CSS nesting, cascade layers, container queries, and the 'has' pseudo-class, which enhance flexibility and efficiency in styling components.

The 'has' pseudo-class allows CSS to select a parent element based on the state of its child elements, enabling more efficient styling without relying on JavaScript for certain interactions.

Container queries allow developers to apply CSS rules based on the size of a component's container rather than the viewport, enabling more responsive and adaptable component designs.

Developers can stay updated with Tony Alisea's content by visiting TonyAlisea.dev for links to all his courses and resources, and by checking his YouTube channel for new videos.

Tony Alicea
Tony Alicea
11 min
21 Nov, 2024

Comments

Sign in or register to post your comment.
  • Perspective
    Perspective
    Great talk! Everything was explained to cleanly, it is indeed time for devs to fall in love with CSS.
Video Summary and Transcription
Hi, I'm Tony Alisea, a developer with over 25 years of experience. CSS won in the 90s due to its separation of structure and presentation, cascade concept, and powerful selectors. JavaScript developers fell out of love with CSS when they started using frameworks to construct the DOM. Instead of looking at the DOM holistically, we began to think in terms of componentization. CSS has continued to grow and add extraordinary features, such as CSS nesting and cascade layers. CSS layers give more control over the layering of CSS styles. Container queries allow us to respond to the size of the container instead of the viewport. The has pseudo class enables selecting parent elements. CSS is now more component-friendly and improves the user experience.

1. Introduction to CSS and Its Challenges

Short description:

Hi, I'm Tony Alisea, a developer with over 25 years of experience. CSS won in the 90s due to its separation of structure and presentation, cascade concept, and powerful selectors. However, JavaScript developers fell out of love with CSS when they started using frameworks to construct the DOM.

Hi, I'm Tony Alisea. I've been a developer for over 25 years. I've taught over 350,000 students web fundamentals on my courses on Udemy as well as Pluralsight Teachable. You can find my stuff on my channel on YouTube. You can find links to everything I do, including my courses at TonyAlisea.dev. You can also find help for everything that your dev team does at TheSmithGroup.com.

Now, this course is It's Time to Fall in Love with CSS. Now, this. Now, let's go back in time for a moment to the 90s. Now, there wasn't just CSS as a concept for how you style HTML documents. There was, in fact, a lot of different ideas, different possible standards that have been put out there. But in the end, CSS won. Now, and there's reasons for that. Now, what are some of the reasons? Now, there's reasons that developers loved CSS. People working on websites loved CSS. For example, there was the separation of structure and presentation. HTML and CSS. Now this there was the idea of the cascade. Multiple style sheets could be applied to a single document or multiple rules to a single document, and they would cascade together. To form the final presentation. Now, this things like selectors, the power of selectors being able to select different elements within the document, that power really helped CSS win over the competing concepts. Now, this now this.

So when we think about CSS, then we were looking at styling the DOM holistically. You're looking at the entire document, the entire HTML structure, the entire DOM tree making selections and then styling it. Now, there's things like CSS zen garden where a single HTML file is presented and then people can submit various CSS, various style sheets in order to then. Now, this is that document in a variety of wildly different ways, it showed the power of CSS. Now, this CSS won because of the problems that it solved and how it solved them. But then something happened. Now, this JavaScript developers fell out of love with CSS, the memes started, started talking about how difficult CSS is, how difficult things were to do in it. But why?

Now, this the big part is because of the change when we went from writing our HTML and our CSS to using things like JavaScript frameworks to construct the DOM.

2. The Evolution of CSS and Its Powerful Features

Short description:

Instead of looking at the DOM holistically, we began to think in terms of componentization. JavaScript developers fell out of love with CSS due to conflicts with JavaScript frameworks. However, CSS has continued to grow and add extraordinary features, such as CSS nesting and cascade layers.

Instead of looking at the DOM holistically, we began instead to think in terms of componentization. Now, everything is a component and a component really is a subtree of the DOM. Now, this is not looking at the whole page presented to the user. Instead, we're thinking about small sub trees and then being able to move those sub trees around within different DOM structures, components, component that component is fundamentally different from looking at the DOM holistically.

So the thing is that JavaScript developers working in JavaScript frameworks that were building the DOM for them, the things they didn't like were the very things that people fell in love with CSS for that separation of structure and presentation. JavaScript developers would say, well, we don't want to spend our time sometimes in JavaScript and sometimes in CSS and sometimes in HTML component cascade. Well, that was a problem because of my components. If I move my component from one container to another container, the cascade rules override and I have to think about what might happen with the CSS on that page. Selectors that required the DOM structure to be consistent. And if I'm making a component and moving it around, then who knows what the final DOM will actually look like?

As a result of the sea change, we went from HTML that might look like this, where we're defining our classes and using them along with our structure, the things becoming popular now like this, where we're just focused on a particular element and just the styles for that element, in some ways doing the opposite of what CSS was intended for, and a negative downside being becoming more focused on what the CSS needs to be. And just adding a div so that I end up getting a component that looks like the prototype. But CSS has continued to grow and to add some really extraordinary features. It's time for the modern JavaScript developer, the modern front end developer to fall in love with CSS. Again, what are some features of modern CSS that works so nicely now? With the componentization of the DOM. Well, let's just look at a few examples. One is CSS nesting. Previously, we might say, well, I have a notification class for my notification component. And then if it's actually a success notification, then I add a secondary class on that. And those are all separated in your CSS rules. But now, with natively supported CSS nesting that is in the browser, in the CSS specification itself, we can show in the way that we write our CSS that all of these rules are connected to each other, that they're part of the same set of rules. Now, it's really just syntactic sugar, meaning it doesn't add anything that couldn't be done before, but it's a much nicer way of writing your CSS, especially when you're writing CSS for a component, when you're writing another feature, cascade layers, the at layer keyword. This allows me to group my different CSS rules and then order them of their own specificity, but not really specificity, but ordering which layer should have higher precedence in the cascade.

Check out more articles and videos

We constantly think of articles and videos that might spark Git people interest / skill us up or help building a stellar career

Install Nothing: App UIs With Native Browser APIs
JSNation 2024JSNation 2024
31 min
Install Nothing: App UIs With Native Browser APIs
Top Content
This Talk introduces real demos using HTML, CSS, and JavaScript to showcase new or underutilized browser APIs, with ship scores provided for each API. The dialogue element allows for the creation of modals with minimal JavaScript and is supported by 96% of browsers. The web animations API is a simple and well-supported solution for creating animations, while the view transitions API offers easy animation workarounds without CSS. The scroll snap API allows for swipers without JavaScript, providing a smooth scrolling experience.
Build a Design System with React and Tailwind CSS
React Summit 2022React Summit 2022
27 min
Build a Design System with React and Tailwind CSS
Top Content
This Talk discusses design systems and how to build one using React and Tailwind CSS. Tailwind CSS provides utility classes for building complex layouts without writing CSS rules. Custom colors can be added to the Tailwind CSS config file, and font styles and text sizes can be customized. The entire Tailwind CSS configuration can be customized to meet specific requirements. Base styles can be added to the config file itself using a plugin. Reusable components can be created with Tailwind CSS, allowing for easy customization of size and color.
Pushing the Limits of Video Encoding in Browsers With WebCodecs
JSNation 2023JSNation 2023
25 min
Pushing the Limits of Video Encoding in Browsers With WebCodecs
Top Content
This Talk explores the challenges and solutions in video encoding with web codecs. It discusses drawing and recording video on the web, capturing and encoding video frames, and introduces the WebCodecs API. The Talk also covers configuring the video encoder, understanding codecs and containers, and the video encoding process with muxing using ffmpeg. The speaker shares their experience in building a video editing tool on the browser and showcases Slantit, a tool for making product videos.
Rethinking CSS - Introducing Stylex
React Finland 2021React Finland 2021
25 min
Rethinking CSS - Introducing Stylex
Top Content
CSS + superpowers - bloat. How Stylex creates a zero-cost abstraction that gives CSS superpowers.
The New Defaults of the Modern Web
JSNation 2025JSNation 2025
10 min
The New Defaults of the Modern Web
Top Content
The speaker reflects on past experiences developing various websites, highlighting challenges faced in achieving visually unique sites with similar functionalities. They discuss hacks used in web development, the evolution of CSS and web APIs, and express a desire for modern web defaults. Challenges with mobile viewport height on touch devices are described, along with the evolution of hacks into simpler CSS solutions. The evolution of scroll behavior, scroll snapping challenges, and scrolling interception techniques are also discussed. The text covers animation challenges, transitioning to promise-based animations, and the use of frameworks for animations and view transitions in web development.
WebHID API: Control Everything via USB
JSNation 2022JSNation 2022
23 min
WebHID API: Control Everything via USB
Top Content
Today's Talk introduces the webHID API, which allows developers to control real devices from the browser via USB. The HID interface, including keyboards, mice, and gamepads, is explored. The Talk covers device enumeration, input reports, feature reports, and output reports. The use of HID in the browser, especially in Chrome, is highlighted. Various demos showcase working with different devices, including a DualShock controller, microphone, gamepad, and Stream Deck drum pad. The Talk concludes with recommendations and resources for further exploration.

Workshops on related topic

Writing Universal Modules for Deno, Node and the Browser
Node Congress 2022Node Congress 2022
57 min
Writing Universal Modules for Deno, Node and the Browser
Workshop
Luca Casonato
Luca Casonato
This workshop will walk you through writing a module in TypeScript that can be consumed users of Deno, Node and the browsers. I will explain how to set up formatting, linting and testing in Deno, and then how to publish your module to deno.land/x and npm. We’ll start out with a quick introduction to what Deno is.