The Future of CSS

joshwcomeau.com

388 points by soheilpro 9 hours ago


paczki - 7 hours ago

As someone who actively goes out of my way to stick to writing vanilla HTML/CSS/JS as much as possible, it's honestly hard to explain to people who only write within frameworks how good it's gotten. Use the proper tool for the job, of course, but it sparks joy!

fodkodrasz - 4 hours ago

Wow even more fancy border styles! Infinite complexity for useless eyecandy. Date pickers are still barely working, last time i needed to build a touch optimized interface (gloves, industrial setting) with date picker, time picker, and numeric up/down style input fields it needed custom components and js...

But who needs these, when we can have bezel and whatnot...

Who needs ways to reliably trigger the display of the touch platform-native keyboard, to be notified if it is displayed and to move the input field in view so it is not obscured by the keyboard?

This is why the web is a terrible platform compared to Windows Forms for getting stuff done. Because those making the standards only work on creating gimmicks.

CharlesW - 8 hours ago

Since I’m in before the negativity: I love CSS! For whatever reason, it’s always made sense to me. I have great respect for everyone with the tenacity to push on improvements that might take 5-10 years to be in common use, if at all.

thisislife2 - 2 hours ago

"Functions in CSS" - Bah! That's all we need to make CSS even more convoluted - make it compete with Javascript now ... All these feature creep is just to make sure nobody else can create another browser engine.

afavour - 7 hours ago

I’m part of the seeming minority that really enjoys working with CSS. And the way I use it today is so different than I did a few years back, e.g CSS modules, declaring a palette with variables then changing it for dark mode… it’s genuinely great to work with.

PennRobotics - an hour ago

Corners and borders have been a pain since the beginning of GeoCities. I do wish fancy corners would go away---to the point that I actively make this happen with a global Stylus rule setting border-radius to 0.

Look: Three of these 10 "improvements" deal with corner shaping, and two more will inevitably need extending, as I imagine frontend devs get around to, "GPT make reading-flow responsively round only the outside corners," and, "Claude how to squircle the individual grid cell borders when using rule gap decorations."

I understand CSS wants to do all of the things and do them well, but then the eye candy gets overused on every webpage and web framework template to the point that practically no site feels different; it's all "logo, four links, giant-ass 'call to action' rounded button in the bold colored top nav, rounded corner cards in a grid layout 3 to 4 cells wide (or in a slider), gratuitous whitespace, rounded corner everything actually, maybe a gradient text or background or both, hamburger menu on mobile, all styles inlined in the HTML classes".

Going down the list of Fortune companies, three of the top 50 don't "round corner" everything: Berkshire, Exxon, Morgan Stanley. A few more would count if you permit rounded buttons only. Marathon is a weird outlier; they have hexagonally rounded elements buttons. (Also, some of these sites must be hosted on a Zune. It takes 50 full seconds to load Cencora's main page.)

I can't say that I do web dev any better, although I am disappointed by the looks of the modern internet, and I don't think more artistic flair will make it better, just as I don't think houses and cars and suits benefit from strange shapes and colors.

although maybe more choice will free us from the confines of everything looking like Tailwind? (Despite my complaints, I am grateful for progress and also am absolutely not looking forward to people misusing functions and dropping 18 errors and 11 warnings into console.log AHEM LENOVO because they can't be troubled to write good code/markup.)

4b11b4 - 4 hours ago

Good to see Josh writing, especially after his courses have taken such a hit. He is excellent. As an electrical engineer and also now CS grad and someone who has purchased his courses wanting to be able to work across the entire stack.. yet have also thought "thank god I don't really have to learn css" now (yes, due to increasing model performance).

On that note I may know just enough to be dangerous thanks to Josh (casting spells: e.g. shouldn't we group those in their own container and then within that container shouldn't that be a flex box?). I guess I'm here to say humans are full of contradictions.

alberth - 7 hours ago

Maybe I’m alone, but all of those suggestions seem to make CSS needlessly complex (or more like JS).

Especially functions.

Makes me think of a previous post from the author, who wrote 100k lines-of-code to power their blog.

https://www.joshwcomeau.com/blog/how-i-built-my-blog-v2/

watersb - 6 hours ago

The discussion here reminded me of one of my favorite demos, someone live coding Qt5 and QML on a first a generation Raspberry Pi, 1080p HDMI. Sort of a mashup of CSS and JavaScript for simple shaders. Fourteen years ago.

https://youtu.be/0j-Wakm5B84?is=7dU_EvFyk_nQNwjO

It's like a peek into a CSS future from a different timeline. Something we could have had.

unsupp0rted - 5 hours ago

> If you’re familiar with JavaScript, this should feel pretty familiar. We define new functions with @function and specify the returned value with result.

It used to be that HTML was for content, CSS was for layout, and JS was for "code"

Now JS is for content and layout and code, HTML is for content and layout, and CSS if for layout and code

markasoftware - 4 hours ago

I know this post isn't about vibecoding frontends, BUT...

Many of my coworkers and friends are rejoicing that they don't have to write frontends anymore. I actually think that frontends are the last thing that should be vibecoded. It's the part that faces the user. It's what helps the user form their first impression of your product. If your landing page looks like it was made in 30 seconds by Claude, they'll assume the rest of your product was too. Use AI assistance on the parts of your codebase where only raw functionality matters (eg, the backend), and put real human effort and care into the frontend that reflects the effort put into the rest of the system.

herpdyderp - 7 hours ago

A bit strange to me how Josh beings with heralding the browsers working together and then every mentioned feature is Chrome only. They're nice previews for a potential future I suppose!

koolala - 7 hours ago

The new responsively-sized iframes standard is an exciting one for me not mentioned. It's finally a step beyond the original frames and framesets. It will let us design sites out of iframes as building blocks instead of needing to use web components. Websites made out of websites.

stsch - an hour ago

What a beautiful blog and post. Highly appreciated, especially in the current times. :-)

thibran - 5 hours ago

The future of HTML/CSS and hopefully JavaScript is, that it no longer used and replaced by a new technology stack.

Especially CSS is such a miss fitting technology for what it is used today, that web frameworks actively fight it, by trying to keep its scope to components.

When looked at web tech from a distance, it is cristal clear to me that we need something new.

Instead of all the abysmal complicated rules of CSS, we would probably be much better served by something like ElmUI (a modern advanced version of the idea) + some scripting for dynamic things.

manlymuppet - 6 hours ago

Is there any implementation proposal which exists that makes relative corners automatic?

If you want them now, you have to do sort of verbose and clunky calculations to get outer corner radius.

[Outer Radius = Inner Radius + Padding](https://www.reddit.com/r/Design/s/oal9fZclJS)

This seems like something standard enough to be a built-in feature.

lopsotronic - 7 hours ago

Been waiting a long time for CSS inherit() . . . although I freely admit that (and CSS Functions) open a respectable-sized can of worms. Sort of like what transclusion and conditionals do for document markup.

Anchor Positioning would be sweet and doesn't feel like it's got so much baggage.

lelanthran - 5 hours ago

Hah;

> The Anchor Positioning API allows us to anchor one element to another.

Hello CSS, Welcome to 1996 Delphi :-/

lioeters - 7 hours ago

Do we really want functions in CSS? I guess that ship has sailed a while ago, since CSS reached Turing completeness.

  /* Define a function: */
  @function --gradient-to-transparent(--color, --direction: bottom) {
    result: linear-gradient(
      to var(--direction),
      var(--color),
      transparent;
    );
  }
Why not provide better integration with JavaScript, to make this kind of acrobatics unnecessary.
weinzierl - 3 hours ago

CSS was born out of the idea that content and presentation should be separate with the former controlled by the author and the latter by the consumer.

Most of CSS's design was informed by that idea. That styling is in separate files in the first place and then all the complicated cascading stuff that is even in the name of the thing.

I've always been fond of that idea and still am but there is no denial that it utterly and completely failed and now we live in a world where all these things are just cargo cult. Sometimes I think it'd be best to finish what Tailwind started and be consequential about it which would mean going back to presential HTML alltogether.

jackie10673311 - an hour ago

Great Atricle

kumarvvr - 6 hours ago

I am very much excited for the future of CSS. And I love that functions are a part of it.

I spent 3 months this year testing out a reporting system for large quantities of dynamic data.

My requirement was to generate pdf reports, but didn't want any reporting tools and installations. Especially something like Microsoft Excel, which the old system was based on.

After a lot of tests and proof-of-concept apps, I finally zeroed down to simple, pure, self contained html, that I am generating from a python script.

And it's glorious.

I am generating interactive charts when the html is viewed in the browser, and hiding all of them and only printing static svg images when in print mode, using css media print queries.

And there is so much more.

The format is awesome for ingestion by ai models.

piro0919 - 4 hours ago

I built a web app with Claude Code without reading the code it wrote. I only asked for things like "add outer margins to the menu and header, with a transparent blurred background," and it came out the way I imagined.

astrod - 6 hours ago

I forgot about functions!

I always thought that everything from Sass was pretty much ported over by now.

FDEUp - 8 hours ago

Say it with me:

Broad support for new CSS features is GOOD.

Making BASIC SITE FUNCTIONALITY depend upon new CSS features is bad.

boxed - 4 hours ago

> It was implemented in Firefox back in 2019, but there wasn’t much movement with other browsers for years

Just call it like it was: Chrome. It was Chrome that didn't move. We can all see the graph :P

efilife - 2 hours ago

I hold the opinion that adding anything to CSS is a bad idea. It's already complete, you can do almost everything you'd want in it, and if you can't there's always javascript. Updating CSS forces people to update their browsers and we get that never-ending chase of compatibility. It's just breaking stuff for a little benefit

jamienk - 7 hours ago

Still can't tree shake. It's what makes my old css files grow into monsters. I feel like everyone has given up on this.

Thanemate - 4 hours ago

Thankfully, now that our machine God is here, we don't need to bother ourselves with learning new CSS features. Just feed the article to the machine as part of the spec and it will handle everything.

NooneAtAll3 - 3 hours ago

so funny to start the article with "Interop that all compilers unite to implement together" and then proceed to show features available only in one browser

ifh-hn - 4 hours ago

At what point is CCS just another programming language? It's getting there, no?

stasaibridge - 2 hours ago

cool stuff

slopinthebag - 6 hours ago

this is like the webdev version of the c++ people who love talking about how great the modern version of their language is, ignoring the fact that all the bad stuff is still in there...

remove inheritance and cascade from css and then we'll talk. but for now ill stick to tailwind.

sneak - 6 hours ago

CSS was done a long time ago. Stop changing it.

randfur - 5 hours ago

interpolate-size: allow-keywords holy shit, didn't know I'd see the day...

shevy-java - 5 hours ago

In general I like CSS, but ...

a) they keep on making CSS more and more complex. You can reason in favour of it, of course, but it is undeniable that CSS becomes more and more complex - and complicated, too. Which leads us to b)

b) "CSS Subgrid is a good example. Subgrid is a super-powerful extension to CSS Grid which enables entirely new layouts."

Well ... I wanted two flexible divs side by side. It is possible, but there are like 5 different main strategies for this, grid is one of them.

Now via a "subgrid", they acknowledge that the existing ways SUCK. So they add yet-another-component here. This reminds us of:

https://xkcd.com/927/

I started to go back to oldschool - HTML tables.

People can hate it, but they work really almost flawlessly. I am not saying I use them for everything, but I totally changed my mind after I saw how flexbox and other things SUCK to no ends. So I now compare all of them to HTML tables. If they suck more than HTML tables, I discard them. This is my quality metric now. And a lot of this has to do with developers making these decisions, failing hard at DESIGN. What happened to simplicity? HTML tables are simple for the most part; they are kind of like a grid already.

taventix - 4 hours ago

you need to be a pro to build fancy shit with vanilla css xD

adrianhqs - 2 hours ago

[flagged]

derekhong - 8 hours ago

[flagged]

georgestones - 6 hours ago

[dead]

jocelyner - 7 hours ago

[dead]

dolebirchwood - 7 hours ago

[flagged]

asdfsa32 - 7 hours ago

HTML and CSS are like bash, no one would use them if it wasn't for the fact that it is everywhere.