Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
Kage9116yI haven't tried it, although my coworker is all for it.
I'm not sure what to think about it and I'd love to hear what you guys think about it. -
Makes your HTML look gross. Why is underline a class? It's just inline styling in disguise.
Useless. -
@AlgoRythm Why would that be? Would you keep max one class per element instead? Never make components?
-
@ScriptCoded Classes define a style which is as self-contained as reasonable. I usually Max out at three or four classes per item. For example, I have items like "unselectable action" and I will define it as such:
.unselectable{
user-select: none;
-all-the-prefixed-shit: none;
}
button.action{
background: blue;
/* other styles to completely define this button */
}
Any specific items such as font size or underline should be either specified inline or by ID, if they are not part of the typical style. If you find yourself underlining quite a lot of buttons, that's probably a class of it's own, and it should be treated as such. It should extend the action button.
button.action, button.action-underlined{
/* (Styles for button.action) */
}
button.action-underlined{
text-decoration: underline;
}
Usually I would apply more than just one style. I would not typically just make a action-underlined class. This serves only for example. I am more likely to make a button.action-emphasized class and apply a few additional styles. -
@ScriptCoded I have used ! important once. And it was dealing with someone else's code.
-
CSS Cascades for a reason. Define your styles for buttons, then modify that style for specific classes of button.
Turning CSS into inline styling is a bastardization of the technology. -
xewl41266yTailwind is awesome, when used correctly.
Setting classes directly onto elements is NOT the endgame. It's meant to be able to test and prototype as if you'd write normal css styles inline. In the end you'd be using these classes in container/wrapper classes, which get compiled down to plain css.
It can bring some overhead CSS though, so be sure to use another tool to minify and strip out unused classes. -
verbis10876yCheck out https://mesh.versustune.de/
100kb pure css framework, very close to completion. -
@AlgoRythm What you're saying actually makes sense. However, it's quite the opposite of how I've learned to do things. I would probably have quite a bit of a struggle with doing it that way, but as with anything it's probably just the learning curve. I won't refractor our whole code base to try it out rn, but I'll try it sometime ;)
Related Rants
What do y'all think of Tailwind CSS?
https://tailwindcss.com
question
css
tailwind