5 ms·
This website has no class
- xandrius 1y agoSo even almost classless websites can be laggy websites.
- chamomeal 1y agoIt was super snappy for me. The snappiness actually stood out. In us east
- xandrius 1y agoIn the EU on Firefox mobile and was weirdly slow.
- Alifatisk 1y agoIt was snappy for me, also in EU on Firefox mobile
- max-m 1y agoOn my old phone (Nokia 8) the random header image takes a while to process and afterwards the content pops up. On my Pixel 8 it's basically instant. Both times tested in Firefox.
- deleted 1y ago[deleted]
- gloosx 1y ago>This website has no class f12 -> ctrl+f -> "class" ><pre class="language-css">... NOOooooooo. They LIED to me. I officially state that this website HAS CLASS
- iLoveOncall 1y ago> I removed a non-trivial amount of CSS (now about ~5KB of CSS over the wire for the entire site) That's around 2% of the size of the single page of that article, it absolutely is a trivial amount, especially when it complexifies so much the maintenance or addition of the website.
- Gabrys1 1y agoThe 5KB is trivial. They don't mention how much was actually removed. Maybe 200KB? Who knows
- drcongo 1y agoIt has also vastly simplified the maintenance of the website.
- OtherShrezzing 1y agoIn fairness, the page loads two enormous fonts. Lots of blogs just use system fonts, so the advice is generally useful if you're trying to reduce your own site size. The total payload without the fonts are around 12kb, so reducing the CSS to 5kb is a fairly big deal. Without the fonts, the entire site could be delivered in the first TCP packet.
- philipwhiuk 1y agoIt'd be even more irrelevant if the site didn't do "public,max-age=0,must-revalidate" on the CSS file.
- gherkinnn 1y agoI recently went down a similar path to build the FE of an app. It worked fine at first and I learned a whole lot about recent updates to CSS. And boy, has it come a long way. Cascade layers, nesting, and the :has selector tripple-handedly change how views can be written for the better. It is a solid solution for blogs and apps with a distinct document feel, but for anything beyond that I found it too limiting and brittle. Back to components and Tailwind.
- zwnow 1y ago[flagged]
- lawn 1y agoI've never heard anyone complain that CSS is too limiting. If anything it's the opposite.
- h4ch1 1y agoI don't get this comment at all; you say CSS is too limiting but somehow Tailwind, which is just applying CSS using classes is liberating? Tailwind actually complicates a lot more things, when you have to specify variants for example, there you go installing tw-variants, writing Javascript just so you can get different sorts of buttons. This is fine for larger component libraries like shadcn-ui, but for simplicity, I'd pick up pure CSS for something like button .error; and button .secondary. (yes I know you can just @apply whatever you want inside those blocks, but what's the benefit of tailwind then?)
- robertlagrant 1y ago> you say CSS is too limiting but somehow Tailwind, which is just applying CSS using classes is liberating If you read the article you'll see what they're talking about. It's not "CSS is too limiting" it's "CSS only applied to elements is too limiting".
- gherkinnn 1y agoLooks like I threw myself in to a Tailwind flamewar. I should've known better. TW+TSX is easily the most productive way for me to write UIs and has been for 5 years. Don't like it? Don't use it but please leave me alone.
- Iv 1y agoWell, HTML was supposed to be a generic language to describe typical documents. Most websites don't need more than the default elements. From an outside perspective, it is perplexing to see the constant back and forth webdevs do between making website more complex and rediscovering the simpler first principles
- zwnow 1y agoI am sorry but its not the devs who want complexity. Users and Designers want a snappy interactive UI with lots of animations to get the "vibe" right. Devs are usually fine with websites looking like they are straight out of 2003 (considering all the language doc pages I've seen)
- zelphirkalt 1y agoThat depends very much on the type of developer. Personally, I would first try to get the semantic structure of HTML right for the content I want to display. Then I would look at what I can do in CSS to make it look nice, but without going full overboard. Stick to things that are now standard in browsers, and that are responsive and resize and float nicely. Perhaps, if necessary even something like the checkbox hack, but probably try to avoid it, since it is a hack. Then the site already looks sufficiently good usually. At no point in this comes JavaScript into play, because this is about visuals, and that should be handled by HTML and CSS. I will use JS, when I have something dynamically changing and/or interactive on a page, and I will try to make a noscript alternative, perhaps usable by the user simply reloading the page. However, I have also seen a lot of frontend devs, who just throw JS framework at everything and since everything is JS anyway, they also do things that could be simple HTML and CSS using JS instead. The result are those pages, where one is greeted by a blank white page, when not running JS. So there definitely are a lot of devs, mostly frontend devs, that do this kinda thing, and it often secures their job by introducing complexity under the guise of looking fancy. Example from a previous job: Making buttons that have 2 corners cut off, but the main navigation bugs regarding responsiveness, that led to broken layout took 3 months to fix. Transferring a navigation from one project to another? 3 weeks.
- thiago_fm 1y agoI love the design of his blog -- the use of dots, link highlights etc. It also brings back memory of 2000s internet, but merged into Today's design standards. I assume this was intentional.
- Martin_Silenus 1y agoIts link hovering effect is probably the worst I've seen for a long time, not to mention the fact that it just makes it unreadable.
- thw_9a83c 1y ago> link hovering effect is probably the worst I've seen for a long time Interesting effect but also a clear form-over-function kind of brutalism.
- habibur 1y agoRight click -> view source. Found "<span class=..." — What? Read the page. Footer : "I only got 99% of the way there. I use 11ty’s syntax highlighting plugin, which uses classes for styling."
- progbits 1y agoI think that's fair. It's not semantic information (I mean in a way I guess it is, but you wouldn't want a screen reader to present it as such), so classes are fine there.
- xandrius 1y agoIt says no class though.
- elaus 1y agoYeah, that title is absurd. The page contains 175 "class=..." attributes.
- grebc 1y agoIt’s mentioned in the article that code highlights still use classes.
- dayvster 1y agoHah that's a cool and creative exercise. Love the writing style as well
- deleted 1y ago[deleted]
- the_other 1y agoI like it. Nice effort. Plus I like the visual style a lot too. I feel there's a mismatch between creating novel "semantic" elements, and then customising them in the markup, rather than the contextual approach (nesting, rich selectors). The mismatch is that the new elements still apply a "what" approach, but the attributes used for customisation apply a "how" approach and leave it in the mark-up. It's still like `<p class="red" />` rather than `main p { background-color: red; }`. I get that there's a trade-off between purity and code that's nice to work with, and I think you've hit a very readable, appealing and creative balance.
- singularity2001 1y agoIt also has no style
- admissionsguy 1y agoI can only see ~half of each line on my phone and cannot scroll, so whatever they are doing, they are doing it badly.
- paganel 1y agoAlso, can't seem to be able to select text, for one reason or another.
- defanor 1y agoI can see whole lines and select the text in a desktop Firefox, but the fonts are messed up (thinned and otherwise tweaked) and colors are set to reduce the contrast, making it hard to read. As with most of the design-related articles, I had to use the reader mode to actually read it. But the content can be guessed from the title (with a hint that it is about CSS) anyway: they have simply removed CSS class selectors, replacing them with element selectors, adding combinator selectors, pseudo-class selectors, and so on.
- deleted 1y ago[deleted]
- jrrv 1y ago:%s/;/:
- chamomeal 1y agoThe dark option is definitely the most readable but wow those other themes on this site are super nice looking!!
- CafeRacer 1y agoGreat job! But, I'm sticking to tailiwnd :D
- 701mk 1y agoThat's why I like using PicoCSS on small projects, it instantly adds style without much classes needed.
- fatih-erikli-cg 1y ago[dead]
- edent 1y agoI love this - and I applied the lessons to my own site. It was fascinating to see just how often I'd slapped a class on something which was never going to be re-used. Similarly, WordPress spams tonnes of classes everywhere. Most are unused. So I took a look at rewriting my CSS to target by logical structure, rather than just random names dotted about. It mostly worked well, although it did mean that I occasionally had to write a selector like: `li[itemtype="Comment"] > article > div[itemprop="author"] {}`
- coneonthefloor 1y agoI really like the concept of this. I'd love a html reference guide (pattern library?) with plain html no CSS or JS to document the basic building blocks of the web.
- bgarbiak 1y agoI tried this approach years ago. Now I consider it an anti-pattern. You really don’t want the look of your website/document to be dependent on its structure. Things like li:has( > a + p) - it seems so clever initially, but then you need to have a button instead of an a, or an icon, or a wrapper over entire thing; but only for a single item on the list. You either end up with messy CSS that covers all these scenarios, or you just go back to classes. I kinda see a potential usefulness of custom attributes, but I’m still not entirely sure how they’d be better than classes. What’s the advantage of [shape-type="1"] over .shape-type-1?
- clan 1y agoIs there no middle ground? I love the clean approach with classless. Documents do have a structure and is makes it easy to change by just swapping out the CSS without touching the document. But could you not just add the class only when you really really need to break the structure? The middle ground for me would to do my utmost to avoid classes within reason. So as few exceptions as possible. I know this is selling elastic bands by the meter. On the other end you have Tailwind CSS. I know many are happy with it and find it has a nice developer velocity. But I find it overly verbose and "framework of the day"-ish. So for me it is classless until my head hurts. Then I'll sprinkle in a class to get work done.
- ysavir 1y agoIt depends a lot on the rate of change of the document. Documents that experience little change don't need classes because their structure is reliable. Documents that change often have unreliable structures, and will require frequent updates to the CSS rules to match structure changes. Using classes insulates the CSS from the document structure, mitigating the need to update CSS as the document evolves. It also depend your development strategy. If using Vue components and writing the CSS in the same file as a dedicated, small-scoped components, it's practical to update the CSS references alongside the document changes. But when there's distance between the HTML and the CSS, or there are components in use who's structures may change unpredictably (such as from 3rd party libraries), classes provide a safer reference. There's no need to have an ideology of using classes or not using classes. The practical approach is to assess the nature of your work, the rate of change of the documents, and to adopt practices built around those assessments.
- zero_shift 1y agoWe tried this 20 years ago with "CSS zen" and the Bad Old Days of "semantic CSS". It failed because you cannot completely couple HTML structure and presentation. Usually you have more complex styles and visuals than your HTML can express and trying to invent selectors / HTML heirarchies to describe them gets difficult very quickly In addition you often need to support multiple style systems on a single web application whilst the design evolves, or else it becomes an all or nothing rollout when you change stuff. It's common for engineers who weren't around back then to look at the abstractions that modern FE systems provide, and question if they're even necessary. That's healthy. What's not healthy is assuming they were only invented for fake or historical reasons, and telling everyone to just abandon them for commercial projects.
- donatj 1y agoYou've got the horse before the cart, and completely misunderstand Semantic CSS. The styling should simply serve to improve the content. The content should generally stand on its own without any styling. In semantic CSS the goal is to write your HTML with as little regard to presentation as possible. Your HTML is simply structuring human readable data. At this step you give it no thought of appearance. Styling that structured data comes second. You write the CSS to make the structured data look nice, and ideally do not touch the HTML in the process, at all. The styling is but an affectation. This fell out of favor because people cared more about looking flashy than quality content, they didn't want to put any thought into developing the actual page and wanted to start with the design. It's a symptom of the overall disease of the modern web. This is more achievable with modern CSS than ever before and I pray for it to make a comeback.
- wpm 1y agoI don't do a ton of web development but I occasionally need a little webview or form, and this is exactly how I write them. That's how I was taught, you know, progressive enhancement. I didn't even know there was any other way lol
- munchler 1y agoNote for carriage owners: “Horse before the cart” is actually the correct order.
- blenderob 1y agoHas the author bothered to view source their own website? If I search for class= on their view source, I see 175 matches!
- curtisszmania 1y ago[dead]
- Martin_Silenus 1y agoFunny thing is that it could really have no class.
- donatj 1y agoI did a lot of front end work from about 2000-2015, but I've fallen into almost entirely backend professionally. That said, I still enjoy it and try to keep up. I have a side project SPA I developed using a css pattern I'm calling "apps" Basically I have JS "controllers". Every controller type gets a root HTML element. They pick the element type, these root elements automatically get a css class ala "{controller}--app" Then from within each of these controllers I largely only use un-classed HTML - and style almost entirely based on direct ancestor ">" operators. Something like .sidebar--app { > ul > li > a { // style sidebar } } I generally keep the scope of what is a "controller" pretty small, a few elements deep maximum. It's a sort of hierarchical mvc and controllers have controllers have controllers, so for instance my sidebar controller has a search controller. The search controller just manages its own elements and reports changes via events. This pattern has kept the JS and CSS very clean and understandable, and the generated HTML pristine. I've been hacking on this for close to a decade, it's a fun little side project. It's pretty large in scope yet it's honestly been a delight to work on. The styling of everything is quite scoped so there's very little unexpected problems. The actual HTML is readable and pleasant.
- gethly 1y agoOne way to look at this from programming points of view is interfaces(class) vs objects(id). Tying everything to specific object means refactoring becomes impossible. Whilst also relying solely in on interfaces means you might have too loose of a logic for anything meaningful.
- esher 1y agoMy sympathies! I developed a small CSS frameworks many moons ago [1]. It provided basic styling for elements directly and used the cascading part of CSS a lot. I see the benefits of utility classes and how it fits to web components. [1] - https://medium.com/teutonic-css/retiring-my-own-little-css-framework-e0a130ca2a33 https://medium.com/teutonic-css/retiring-my-own-little-css-f...
- Theodores 1y agoThis is what I like to see, however, I think that more can be done with the document structure. I use a section element to enclose a heading with the paragraphs that immediately follow it, thereby scoping text to a heading. The advantage to this approach is that you 'gain a class' (okay a section) that can be used for styling. I am not keen on adding my own make-believe elements, however, I have found that, if you know your HTML elements, you can write surprisingly human readable HTML. There is no need to be fundamentalist with going 'classless', classes are the way to go for situations such as when an element changes. I also take heed of the HTML5 spec and the advice regarding the use of 'div'. There really is always a better element to use, and, with 'divs' removed, it is trivial to layout any content with CSS grid. Scoped CSS is also a game changer, however, you have to pretend Firefox does not exist, which is fine by me for my hobby site. Scoped CSS means that you can keep the CSS simple without bizarre selectors that the next developer will not like. It all depends on what you are trying to create. If you were to want to do your own version of Gmail then you are in a world of complexity. However, blogs, ecommerce and much else does not need to be a complex mess with a 10000 line 'add to' CSS burden.
- AmazingTurtle 1y agoChecks query selectors > document.querySelectorAll('*[class]'); tons of elements with class
- debugnik 1y agoThe footnote mentions they're stuck with 11ty's code highlighting plugin.
- alberth 1y agoI think the better framing is: "eliminate/reduce the number of DIVs". Because the real problem I see is that the generic DIV is grossly overused, when built-in HTML elements already exist for exactly the use case intended. I rarely see HEADER, FOOTER, NAV, even P because people just use the generic DIV tag instead. https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/...
- deleted 1y ago[deleted]
- cluckindan 1y agoThis makes me confident that BEM-like classes are still the best approach for large and complex sites, as long as the .block__element--modifier pattern is followed, so there are no .block__element__secondelement type classes, and things like nesting, descendant selectors and :has() are avoided where possible. Using custom tags invariably leads to the aforementioned, and browsers need to do extra DOM traversal to target styles properly. Not so with BEM: a flat list of class selectors maps cleanly to elements, so when the browser is parsing HTML to DOM, it doesn’t need to wait for all descendants to be parsed (for :has() to work) or do extra checks to determine whether its current path in the DOM matches a nested or descendant selector. It can just keep on parsing and rendering. This may not feel like it makes a difference if you’re browsing the web on a veritable supercomputer, but for anyone on an older device, the difference will be between instant and kinda sluggish.
- shermantanktop 1y ago> Also, just look at that markup. So clean. So shiny. That’s the essence of so much of this obsessive bit-twiddling: irrelevant aesthetics. The functional aspect of this is a disaster, as others have noted, locking styling to page structure in a way that will require structural changes to the CSS just to move an element on the page.
- draw_down 1y agoYeah. I don’t want to see “wow look at how pretty this markup is”. I want to see “look how flexible and easy to change this is, without redoing everything”. If you’re not talking about change, the other stuff is pointless.
- ulrischa 1y agoI like the idea of using custom elements instead of div with class and being able to gradually enhance it to a Webcomponent if needed. What I think is a bad practice is the nesting of selectors to avoid classes. This leads to a high specificity and to a tight coupling with the html structure. A more modern approach to reduce (not avoid) classes is the @scope and @layer rules. They have a hughe potential for designing components in css.
- animanoir 1y ago[dead]
- candseven 1y ago[dead]
- marleyalisha 1y ago[dead]
- mediumsmart 1y agoI like the title
- createaccount99 1y agoWouldn't using tailwind with `@apply` rules be a double win? You get tailwind to tweak the one-offs, and you get classless in the typical case. A couple kb more CSS perhaps, but that's negligible.