News for hackers. Stuff that matters.
Re:CSS sucks because we don't bother learning it (2022) by kccqzy on Tuesday January 06, 2026 @12:18PM (#46515258)
The brittleness of badly written CSS is unrelated to its cascading nature. In my experience the “cascading” part is a good thing. If you want to make a paragraph red, you do want all other inline elements inside the paragraph to be red as well. Also, in my experience, most of the brittleness comes from an insufficient understanding of selector specificity, including both unintentionally broad selectors as well as unintentionally narrow selectors.

The solution is a careful consideration of scoping: most programming languages encourage the developer to carefully consider whether a variable should be local and global, and a similar amount of care must be taken in CSS too. The programmer needs to have a high awareness of which rules should apply to the whole document and which should apply to this particular component.

There are no comments on this comment yet.