- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
I guess that this in CSS:
is the equivalent of this in C:
Admin
This is basically someone reinventing Tailwind (which is a WTF by itself).
Admin
Classis with using WYSIWYG : you select some text that has existing CSS, and apply a new CSS -- and it does so inside rather than replacing [neith of which is inherently right]. TRWTF are people (calling themselves developers) who do not look at the code from lower operational level... and unfortunately that seems to include the vast majority today [way worse than 13-20 years ago]
Admin
I'm a beginner learning web development. On the one hand, I get why naming classes by content makes sense, but I'll admit it sucks for reusability. How do you strike a balance between the two?
Admin
Was about to say, sounds like Remy is blissfully unaware of Tailwind. Which I remain convinced was intended as a joke but got taken seriously for some reason!
Admin
Sounds more like strong gusts of side wind, leading to a crash during landing.
Admin
That's very offensive language. Have a care. Children may read this. We'll see it through the fingers this time, but please use "Clbuttical Design." from now on.
Admin
Oh, I'm aware. I even had a, "Well, all the kids are talking about it, maybe I should use it on a project," and after about five minutes said, "Nope. Never."
In my experience thus far, I haven't found a CSS framework that was actually worth it. They're all opinionated, which is fine, but their opinions are wrong.
Admin
Does it suck for readability? It sucks if you think the DOM is supposed to tell you what the page looks like- but it isn't. The DOM is best thought of as a model of your UI state. The structure and hierarchy should basically be done without any regard to appearance, only in regards to the structure of the document.
CSS is a function which maps that structure to a presentation. It converts that DOM tree into rendered pixels on the screen. (Yes, the underlying browser implementation makes this flow much more complicated, and understanding it can be important for performance, but we can set it aside for now)
This approach makes it much easier to understand both your DOM and your CSS. It modularizes your code, and makes each part easier to understand in isolation. It also makes it way easier to understand how to modify your page- change the DOM to reflect the new structure, modify the presentational rules to decide what that structure looks like.
Admin
The problem to borrow a quote a bit,is that semantic CSS is the worst solution for style and layout abstraction except for every other one that has been tried. Maintaining semantic names only works if the scope of the application or site is well understand from the start and rarely changes, and everyone on the project that touch anything that spits even a single character of HTML code out some place is a incredibly disciplined.
Admin
Or you could use a JS framework specific library based on a CSS library that was made for a standard website and not the dashboards that you're designing, because it's simpler, easier, and standard. Nevermind the resulting tag soup with class salad that results, usually by hammering whatever letters unintelligibly position things where you want them with the inevitable sprinkling of CSS anyway in extra divs that sometimes don't even need to be split. I love the goal of the project, and have my own stupid opinions here and there, but sometimes... sigh.
Admin
I've done one project with Tailwind. This was a self-inflicted project. Now my son (who's a very good programmer in his own right) and I are having our own private religious war over Tailwind. He seems to think it's great. After I stepped back and took a look at the project, it seemed to me like I had essentially used "style" attributes on everything rather than use CSS.
Admin
As a programmer of many years I'd like to think I've really grokked many things like XML/XSL, SQL, Lisp, React, Serverless, OOP, pure functions, Static and Dynamic typing any many more, but CSS I think is just trying to bite off more than it can chew.
I certainly wouldn't claim to have done my 10,000 hours of CSS but unlike all those other technologies, I can't see how a well disciplined team who knew what they were doing could produce a clean CSS solution for a reasonably sized system without having to bodge it.
Admin
It doesn't help when you use 8-column indentation. Even good HTML often has lots of nesting, so 2-spaces is the de facto standard. Is this in the original or due to Remy's formatting (I've noticed it in many other posts)?
Admin
So Alice said that Bob said that Claire said that the box was round and added that box was purple and added that box was grey and added that the box was horizontal, to which Dave added that it was vertical, as well.
Admin
I always thought it was more a case of WHEN people were thinking about convenience.
Presentational classes (can) make it more convenient to set up the presentation on new things.
Semantic classes are often far more convenient when it comes to modifying presentation later.
In my limited experience (I stopped doing much styling work a decade or so ago), both of them tend to get hairier the more you style things based on their containers and the more you use nested containers for positioning.
If your team almost never does presentation updates without a complete redesign, it's easy for me to imagine the former at least looking like it's going to have a lower total cost of ownership in maintenance time, especially if you use an opinionated framework.
I still prefer the latter.
Consider when on April 1 you need to add
a#log-out-button { background-image: url(https://thedailywtf.com/images/remy/Remy203-300x300.png); background-position: -81px 162px; color: transparent; padding: 4px 15px; }
for example.I don't actually have a demonstration of why that would be any better than if the classes were presentational, I just had fun setting it up.
Admin
The best part about using "red-underline" is when business dictate it should now be a blue strikeout.. Now either red-underline applies a blue strikeout or you have to update all your html files that use the class. I also fail to see how a class that simply describes its own style is any better than just applying the style directly through the style attribute.
Admin
This exactly. It's basically using an abstraction for the sake of the abstraction but in a way that bypasses any of the benefits of the abstraction. Echoing what Steve_the_Cynic posted earlier, it's basically the same as using #define ONE 1. It doesn't help you at all and just gives you extra busy-work. Seems there should be a name for that anti-pattern, maybe Abstraction Slayer?
Admin
It only sucks for reusability if you are doing classes too fine-grained (which is the same for classes in OO). For example, you would not be able to re-use a class called "profile-status-field" or "registry-code-field", but you would name a class "field" then use it on all fields.
Strangely, the html in the article uses classes everywhere except on those fields, it just separates them with br elements.
Admin
How about: Abstraction Assassin(ation)
Admin
I approve!
Admin
I guess the guy didn't know you can just specify multiple classes, separated with a space.
Admin
Pretty sure this falls under the heading of "inner platform effect", an anti-pattern that was first named here.
Admin
I agree with you in principle, but will still point out: A class with a name that just describes the style it applies could still be a shorthand for a style definition that's a lot longer than the class name, or a set of vendor-specific styles or other cross-browser workarounds; so it isn't necessarily entirely without comparative benefit.