8 ms·
We keep reinventing CSS, but styling was never the problem
- spacebanana7 1y agoI wonder how different things would be today if the web browser was originally designed for applications rather than documents.
- gjsman-1000 1y agoOne day, someone just needs to build an accessibility system for WASM; and maybe (additionally) an overlay system telling the browser that pixels X1, Y1 to X2, Y2 are selectable text. The moment we do that; we can theoretically implement any GUI framework we like, rendering to a <canvas> tag, without the current (serious) downsides. I’m looking forward towards more exploration of that direction. Then, we can mostly be free of HTML, CSS, and JavaScript defining how apps can be built. Those three tools that have long outlived their original intentions and have gone into complete duct-tape territory. AI however, might actually solve this sooner than we realize. Apple already uses AI to copy-paste text from images. I’m sure there’s plenty of R&D going on right now on using AI to describe what is on screen. In theory, maybe we can legitimately AI our way out of needing accessibility concessions, and off we go. Build your website in Flutter; or in MAUI; or in some DIY port of SwiftUI; whatever you want.
- tgv 1y agoAnd then we'll return to Java Beans and ugly, inflexible text layout, isn't it?
- gjsman-1000 1y agoWe’re already getting there. At one point we’re just ripping off the bandage. On the upside, most people don’t build their own frameworks. Implement it right in Flutter, MAUI, etc. in such a scenario, and almost nobody will be harmed. Also, for anyone who just says this is Java and Flash all over again - we’ve had plenty of technologies come full circle. WASM might be the one that gets us to full “web as app engine.” It already basically is, just badly.
- pjmlp 1y agoWe already back there, apparently many haven't yet noticed that all those systems have been ported into WebAssembly, the main issue is that tooling experience is yet to follow along. Silverlight, Applets, Flash, all have WebAssembly runtimes now.
- kevingadd 1y agoCan't you already do this by creating a tree of invisible DOM elements with the right ARIA attributes?
- Quarrel 1y agoWhile I am somewhat entranced by the ideal, presumably the realities of SEO and how most of the web is funded would put a stop to it? This is somewhat like the leap Figma has made. They were able to build their own walled-garden, offer value in it, and not have to worry about SEO. Most of the web is not in that position. I'd imagine we'd be better off with more such fragmentation, though? The internet was built to allow fragmentation, of protocols, of tech, of connections. It is just that, of course, most sites must flow to where the easy $ are. Let's just hope that enough good sites can escape the pull of easy $.
- gjsman-1000 1y agoI think the short answer, is SEO is dying rapidly in the age of AI search engines. Search traffic is anecdotally being severely damaged when everyone can just get an AI answer; ad revenue is down especially after the pandemic; SEO spam is increasing from AI-generated websites. We might reach the point of saying, screw it, it hardly matters anymore. The web has been conquered by LOB apps, Paywalls, and Walled Gardens; and there’s no real way to fix that, but there is a way to fix the tech we are using. If anything, if we fully embrace “web as app engine,” we can fix some of these issues ahead of time. Maybe we have a standard entry point for crawlers (or users) requesting the raw text of a document. It’s better than being stuck in this awful in-between which we are right now.
- marcosdumay 1y agoI'm really not sure. People tend to follow that comment with a list of requests for stuff that CSS does, exactly on the way that CSS does. Like separating the text and widgets rendering engines, and placement engines with "stick" orientations.
- brookst 1y agoThat’s what Flash was, and it was terrible. I think some things work better when they’ve evolved from simplicity to complexity, and application hosts seem to be one of them.
- ezst 1y agoFlash was terrible for producing documents, I suppose, but for highly interactive things, nothing matches it, even today (we are getting close in terms of what the web is capable of, performances are getting good, but the tooling and implementation effort/complexity is ridiculous in comparison). I don't think it's so much a question complexity than a question of using the "right tool for the job". Web technologies were never designed for that, never engineered to be extensible. Web apps is a hack, it's terrible, and that's all because of politics.
- ndriscoll 1y agoWeb technologies were designed to be extensible, for documents. e.g. HTML has had a built in templating engine and support for websites defining their own custom tags for 25 years.
- ezst 1y agoAbsolutely, the context there was "extended from simple Document/Markup jobs and into rich applications toolkits".
- pjmlp 1y agoApparently not, given that it is exactly what WebAssembly folks are after, unfortunely with much worse tooling than Flash Studio had at our disposal.
- owebmaster 1y agoFlash was amazing and we lost a good amount of fun online when Apple killed it
- 1y ago
- cbhl 1y agoThere _was_ an outlet for this during the era of Windows hegemony: the object and embed tags. You had your choice of ActiveX, Java, or Shockwave/Flash in the 90s to write applications that you could then embed in the web browser. We stopped using these for a variety of reasons: they were difficult to make secure or cross-platform, GMail made building apps in JavaScript fashionable, and the iPhone (which explicitly would not support ActiveX/Java/Flash).
- quotemstr 1y agoWe had a web for applications. It was called telnet. AOL, Prodigy, and others all had actually-pretty-sophisticated remote application deployment systems with vector graphics and fancy input processing. In the early days of the web, it was also common to write line-of-business apps using tools like Visual Basic, Hypercard, and even Excel (some things never change). The web won over all of them because, as history tells us, there are fitness advantages (e.g. platform agnosticism, easy introspection, and gradual enrichment) to evolving application capabilities into a widget toolkit that you just don't get if you try to make the optimal widget toolkit up front. If Tim Berners-Lee had made the web for apps and not documents, history would have been no different. Somebody besides Tim would have made a remote document system and we'd all be using that instead of something called the web.
- vehemenz 1y agoOr, imagine if they just froze the CSS spec at some point and allowed tools and methodologies to catch up.
- M95D 1y agoWould you please stop trying to execute code on my computer just to show me a document?
- mmastrac 1y agoEDIT: the nested selector popped up without me noticing; removing my comment because I was working from faulty information (and clearly was missing from the blog post)
- marcosdumay 1y agoWe have had nested style rules in native CSS for a couple of years already. https://developer.mozilla.org/en-US/docs/Web/CSS/Nesting_selector https://developer.mozilla.org/en-US/docs/Web/CSS/Nesting_sel...
- mmastrac 1y agoThanks! I legitimately missed this not having done intensive CSS work for a few years. Odd that it doesn't appear much in blog posts. I suppose the patterns are still being worked out?
- lemonberry 1y agoSorry if you know about this, I can't tell from your post. But nesting CSS has been added. Here's the MDN article: https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_nesting https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_nesting Browser support is here: https://caniuse.com/?search=nesting https://caniuse.com/?search=nesting
- quotemstr 1y agoImpugning CSS and not knowing that nested selectors work fine everywhere is just perfect example of what I'm discussing here: https://news.ycombinator.com/item?id=44876345 https://news.ycombinator.com/item?id=44876345
- nvch 1y agoDidn't they do it? https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_nesting/Using_CSS_nesting https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_nesting...
- ale 1y ago
- skipchris 1y ago"Cascade Layers […] give you more control, if your team is ready to learn them" in fairness to css, I think my team would struggle with most technologies they weren’t ready to learn.
- donatj 1y ago> Fast-forward a couple of decades and we’re building highly interactive, component-based, state-driven, design-system-heavy applications Are we actually, in fact, if we're being honest? I haven't seen anything like that. 99.9% of applications I interact with are just a series of simple CRUD operations. Sometimes they add unnecessary complexity and flashiness and of course there are some games and such, but when it comes to actual business apps they all just boil down to updating text records in a database at a human pace. I am genuinely interested to hear examples of these "highly interactive" web apps others are building I keep hearing about but never seeing.
- timw4mail 1y agoIt's all the buzzwords to justify the overcomplexity of web frontends.
- burnte 1y agoI totally agree, maybe 1 in 100 web pages actually NEED any of the code they run. Mostly it's reinventing the wheel. Where a flat site with fixed HTML and pretty CSS would be fine, they add a splash page so they can show a logo, they'll break navigation and reimplement the browser inside the page with JS so you can't use the back button, they'll style everything on the fly when nothing is dynamic, etc. Nonsense.
- _fat_santa 1y agoEasy. It's just about any react/angular/vue based site written these days. Take GMail, Jira, your health insurance portal, TurboTax, and a littany of other sites. Practically every one of these uses components, internal state, and design systems to make the site highly interactive, just about every "web app" falls into this category.
- donatj 1y agoAll of those examples boil down to very simple forms, web 1.0 style forms. CRUD. Fill out an email form, hit submit. Fill out my tax form, hit submit. Fill out a ticket form, hit submit. It's prettied up CRUD, but it's CRUD. There's no high levels of interactivity, nor any sort of need for client side state in any of them.
- marcosdumay 1y agoOh, man. The article doesn't even give "just writing the CSS" as an option... What a world we live on.
- fkyoureadthedoc 1y agoBoth BEM and Cascade Layers mentioned in the article in the list under the heading "Every Option Solves One Problem. None Solve All of Them." are "just writing the CSS"
- setnone 1y agoI embrace the mess of tailwind-cluttered markup to eliminate context switching and save up some cognitive load.
- hasanhaja 1y agoHow's your experience maintaining styles written in this manner? My experience has been increased cognitive load when I come back to tailwind styles after a long time, when compared to dealing with handwritten CSS selectors and classes
- switz 1y agoTo the contrary, far less cognitive load. I don’t have to internalize a class name and where it lives in a style sheet and then context switch between the two.
- skydhash 1y agoNo one does. You either use the web inspector if you need a global view or do a grep to find where the class is being defined. Tailwind is only useful if you have some kind of templating system where you can define components. And in this case, it’s very easy to scope your css.
- vehemenz 1y agoI don't see how that's possible. My experience has been the exact opposite. When you say "handwritten CSS selectors and classes," what you really mean is learning a unique codebase with high levels of abstraction that map on to the DOM in a structured way that cannot be automatically inferred. It has to be learned by looking at both the CSS (often buried in many component files) and how the components are implemented in the DOM. In large projects, this is far from trivial. And I think that's the key. When people say "handwritten" CSS is either, what they mean is that their small project, with no other contributors, is easier to manage. When picking up a Tailwind project, what's to learn again? You might forget some of the class names, but if you already know the CSS properties, you're 80% there. With your IDE's completion, you're 90%. And crucially, no context switching whatsoever.
- montroser 1y agoThe solution is already here, and it's totally fine: Use utility classes just for layout (margin, padding, etc); use scoped styles for your components; use a small set of globally available classes for styling native elements (buttons, etc) -- and you're good! Vue and others have had scoped styles for a long time. Now @scope is spec'd with improving browser support. All this pain in TFA is from people flailing with all of the many bad options that pervade the React ecosystem.
- deleted 1y ago[deleted]
- pier25 1y agoThis is how I write css. In a couple of years people will wonder why anyone would use something like Tailwind.
- owebmaster 1y agoThe utility classes can be tailwind
- pier25 1y agoExcept that tailwind is a huge dependency. Not only it requires a compiler, but editor extensions, plugins, and learning a whole new language to express css.
- owebmaster 1y agonot when you use unocss (and tailwind4, I think, but I don't use it).
- omnimus 1y agoI think this is good advice. I would say many people end up in that style. Downside is that you have to be pretty experienced with CSS to get this right as it doesn't always give obvious solutions. It's often "it depends".
- quotemstr 1y agoHere we go. Let's spin the wheel of front-end framework fortune once again. The article correctly identifies that CSS isn't the problem, but just giving up on elegance is premature. IME, CSS is actually _just fine_ and would do as well as anything else at the job. The real problems arise from: - People just not being aware of the affordances of modern CSS (like nested selectors, variables, fancy grid layout stuff, etc.). Of course CSS is going is suck if you insist on living with CSS3 like it's 1998. - Inherent domain contradictions. "I want isolated styling!" "I want consistent theming!" and like the dog in the "no take, only throw!" meme, "I don't want interfaces. I want my styling to be isolated except when I don't want it to be!" CSS is actually pretty elegant. We should be using declarative, composable configuration (e.g. CUE) in other domains too.
- fkyoureadthedoc 1y agoYou know, none of the mobile developers I work with ever complain about layout and styling. I rarely see fussing about it online either. Makes me think there is indeed something better out there.
- skydhash 1y agoIf people were actually creating applications, you would see less fussing on the web too. CSS is fine and you can always use a framework like bootstrap or bulma. But they want to reinvent every thing under the sun to make their custom widgets.
- owebmaster 1y agoAsk that mobile developer to deploy to different OSes, desktop, wide-screen and you'll find out
- fkyoureadthedoc 1y agoSeems pretty common in mobile dev, the iPad is hugely popular and widescreen. Many apps also run on Mac desktop.
- zx8080 1y agoIt's a vendor-lock problem that's being solved (by google) by all that complexity. Effectively, it's too expensive to maintain core browser (approx. $1B/year for chromium) engine because of all that css and other standards published (and adopted by some developers) every month.
- nativeit 1y agoI thought this was the other way ‘round: Chromium announces it’s adopting/deprecating some tech, and web devs scramble to adapt their websites so they will still work as-expected in Chrome.
- zx8080 1y agoThis too. Add or remove features from de-facto standard. Both works, to keep the barrier of maintaining any modern browser engine at the skyhigh $1B/year price tag. This results in only two modern browser engines available: chromium (by google), and FF (mostly sponsored by google). Very sad state.
- robertlagrant 1y agoNo-one tell Ladybird.
- scoopdewoop 1y ago[flagged]
- quotemstr 1y agoThe article is neither vapid nor pointless. You're just reading it as a technical proposal when the author didn't mean it to be one. Articles like this are meant to be nucleating points for vibe shifts, usually in the form of a preference cascade. Remember how the similarly vapid and pointless Agile Manifesto mysteriously got everyone talking about writing software more flexibly? You're not looking at technical engineering. You're looking at social engineering. In this instance, if the vibe shift attempt is successful (most are not) we'll stop whining about how much CSS sucks and blaming it for our failures and start talking about how to fill CSS's functionality gaps and make it do what practitioners actually need.
- abound 1y agoSomeone had some thoughts and chose to share them with the internet. I think that's cool. If anything about the internet sucks, it's the inevitable unconstructive criticism from anonymous strangers.
- ndriscoll 1y agoBeyond the fact that almost all web "apps" are actually honest documents, let's not forget that operating systems 20 years ago were more "highly interactive, component-based, state-driven, design-system-heavy applications" and still globally (across all applications at once) themeable. So it seems to me that the problem is that modern UI in fact has lost the concept of modular components. e.g. every time someone comes out with light/dark mode as a feature, I can't help but feel like it's an insider joke that's been running so long that the new kids think it's serious. Every single application used to have a more powerful version of that by default. There were GUIs for users that were simple enough to find and use that my 90 year old grandma had customized the theme on her windows 98 machine.
- N_Lens 1y agoYour comment kind of reminds me of old school Winamp and its skins.
- EGreg 1y agoSomeone’s never used the old MacOS before OS X. Anyone remember Kaleidoscope? Someone’s never used Windows before Vista. Remember how themeable XP was across all apps? We had standard OS controls, that’s why all that worked. The web has… extreme customization per website.
- skydhash 1y agoCustomization was ok for the web because it was documents and forms. But then they bring those ideas inside the desktop space where you used to have consistent interfaces for your computation.
- tracker1 1y agoI kind of wish that the OS provided to the browser the following pieces of theme information... 1. is dark mode 2. primary background color 3. primary forground (text) color 4. primary accent color 5. secondary accent color 6. warning accent color 7. danger accent color Then the application could use those to apply overall skin/theme to the web application(s). However, you will still have those sites/apps that want their own. The biggest example imo is Slack. Even material or fluent are similar enough that applications using either tools with the above values for an overall theme would be easy enough to apply throughout an application.
- amadeuspagel 1y ago> React, Vue, Svelte. They all put components at the core. Scoped logic. Scoped templates. Scoped state. Then we hand them a stylesheet that’s global, cascading, and inherited by default. I don't know about react and vue, but svelte has a style tag that's scoped to the component.
- fkyoureadthedoc 1y agoVue has had scoped css for a decade. I was very pleased moving to Vue from zope templates and jQuery spaghetti.
- alternatex 1y agoAll of them have both global and component-scope styles. Not having that flexibility would make a UI framework not viable for modern web dev. Just like with any code, you want to scope as much as possible, but an escape hatch is essential to avoid hacks for those edge cases.
- theletterf 1y agoAh dangit. I was expecting a deeper conclusion. Then I checked on GPTZero and turns out the article is very likely to be AI-made. The header, too (you can tell). I'm not sure I should be taking advice from an LLM...
- bradley13 1y agoCSS is kudzu, growing wild and untameable. The complexity has long since reached the point that implementing a new browser engine would be nearly impossible. The fact that the maintainers don't even any sort of releases, shows just how out of control it is.
- youngtaff 1y ago> The complexity has long since reached the point that implementing a new browser engine would be nearly impossible There are people building new browser engines
- pjmlp 1y agoThe problem is not reinventing CSS, rather misusing a platform designed for interactive documents as application platform. We should have left the Web be Web, and use native applications with Internet protocols for applications, like it has always been until the rise of Java applets, ActiveX and Flash. Then HTML5 came to be, and we have yet to sort out all the mess, but hey should not complain too much, it pays most of the bills.
- moffkalast 1y agoMaybe it's the author's style but this whole thing feels almost stereotypically written by an LLM. Bullet point overuse, "The real question" "Here’s the uncomfortable truth" "this isn't just X it's a Y" On the other hand, top LLMs are better at CSS than just about everyone so it's a top percentile expert opinion at least lmao.
- deleted 1y ago[deleted]
- o_m 1y agoUnpopular opinion: we should treat the web sites less like apps and more like documents with forms. I'm so tired of devs trying to recreate the browser inside of the browser and all the bugs that comes with it