News for hackers. Stuff that matters.
Re:CSS Classes Considered Harmful by TekMol on Monday August 29, 2022 @09:35AM (#32638038)
The problem they describe is nonexistent. They say <div class="card big"> is bad because

    some other CSS can come along
    and co-opt what big means
Doesn't matter, because you would not style ".big" but ".card.big".

Yes, if someone would redefine "card", that would be a problem. That's why this "base class" should not be as short as just "card" but rather "userInfoCard" or something like that.

Re:CSS Classes Considered Harmful by Keithamus on Monday August 29, 2022 @11:22AM (#32639357)
Naming collisions are a pretty real problem when you get to building large systems. They’re a big enough problem for something like CSS Modules to exist (explained further down in the post).
Re:CSS Classes Considered Harmful by leephillips on Monday August 29, 2022 @10:25AM (#32638690)
> The problem [he] describe[s] is nonexistent. [He] say[s] <div class="card big"> is bad because

    some other CSS can come along
    and co-opt what big means
To me the complaint is like saying, when programming, that I shouldn’t define functions with names in a file that’s imported into another file, because “some other” file can “come along” and redefine those names. If that’s a problem then that’s your problem, not the existence of classes. Or names.