3 ms·
Yeah, I really don't get it. As for this part: > when you get into a situation where one of the buttons needs to have slightly more margin-top than the others,
by lgessler 8y ago
Yeah, I really don't get it. As for this part:
> when you get into a situation where one of the buttons needs to have slightly more margin-top than the others, then it's easy to fix
You can have this with semantic classnames. In fact, that's exactly what the "cascading"[1] part of "cascading style sheets" was intended to solve.
[1]: http://cssspecificity.com/ http://cssspecificity.com/
- dsego 8y agoCascading is bad and creates more problems than it solves.
- recursive 8y agoThis is definitely the opposite of my experience.
- dsego 8y agoI see the downvotes already coming. Cascading is bad, it makes it hard or impossible to restructure things and move markup around. And then you have to fight specificity. An example from my work where someone put a bunch of tags under `.new-style` like `.new-style h1` and applies to every container which needs those new styles. Now if I add my component to that container, it completely breaks encapsulation because `.my-component-title` gets overridden by `.new-style h1`. And then you fight that with something ridiculous like repeating classes `.my-component-title.my-component-title`.
- Drdrdrq 8y agoIn other words, improperly used cascading is bad? (didn't downvote you FWIW)
- jacamat 8y agoYes and (moslty) no. Cascading that reaches “outside” of its component to affect other things is bad. So it is all about your approach to the cascade. Most people who have been working on the front end still struggle to grasp the concept of encapsulation & isolation when it comes to their CSS. In my experience working on a web app that sees +80k DAU, the most difficult updates to our UI are ALWAYS in the cases where somebody wasnt cogniscent of the cascade. Or was, and used it when they shouldn’t have. IMO, theres a lot of pushback to this technique and not a lot of questions into its benefits, but plenty of questions as to why its “just like this” so “why should I use it.” I encourage you to consider the benefits of an isolated approach to UI, or perhaps try building something with it and see how the method compares to your current approach. Or, we can all go on assuming that Airbnb, Facebook, IG, et al, have all opted into this approach for no reason
- dsego 8y agoIt breaks encapsulation, leaks styles, you have to fight specificity and it makes it hard to change markup and many more.
- jacamat 8y agoYou’re 100% correct on the cascade being bad and causing incidental breakage. The people downvoting have clearly not run into these problems yet or it would be obvious to them that your reply is in no way wrong, lol