The CSS Cascade (2020)
wattenberger.com
The CSS Cascade (2020)
1–10 of 36 posts
Re: The CSS Cascade (2020)
#2Bad way of framing this, the navigation and phrasing makes it sound like we're going from least to most specific as we scroll down the page but we're not.
> The hierarchy here is actually reversed for !important rules, meaning that an !important browser default rule wins over an !important website rule
I think this would be difficult for a beginner or even intermediate to understand. This chart does a much clearer jobs including every layer of specificity (including with @layer): https://webkit.org/wp-content/uploads/cascade-layers-2048x11...
I appreciate going for an approachable fun way to deliver a dry, complicated topic. Maybe look at how MDN writes about this stuff and get some of the specifics/technicals nailed down a little more.
https://developer.mozilla.org/en-US/docs/Learn/CSS/Building_...
Re: The CSS Cascade (2020)
#3The funny thing is that I even implemented a CSS parser and evaluator without knowing the official terms.
Re: The CSS Cascade (2020)
#4Huh, I always thought the cascade referred to the fact that certain properties apply to child elements (like font size) and others don't (like borders). There are cascading and non-cascading properties. What is described here I would call the specifity (which is actually only one part of it). The funny thing is that I even implemented a CSS parser and evaluator without knowing the official terms.
Re: The CSS Cascade (2020)
#5Re: The CSS Cascade (2020)
#6It's probably not only related to the wacky sidebar, but more related to the main content style, headlines being too large and an overuse of colors and emphasis in each section of text. Choosing to alternate dark and light scheme in the A/B code blocks doesn't seem right either.
Which in a way is neither here nor there, since it's not related to her content. Personally I find the "Funky fact alert! The hierarchy here is actually reversed for..." style of writing to be offputting, but I'm sure some others like it.
Re: The CSS Cascade (2020)
#7Multiple inheritance is also usually discouraged for similar reasons, but not in CSS in the way you can combine classes together without restriction (with `!important` and specificity on top of this).
And is CSS cascading actually a good approach that scales to complex UIs and designs? Is this approach successful anywhere else or is there a way to do styling that's closer to regular programming? CSS seems to be in its own world with lots of debates about best practices.
Re: The CSS Cascade (2020)
#8Which rules wins is the rule that is the most specific. This article explains it as having 'the most hits'. Whatever that means.
https://developer.mozilla.org/en-US/docs/Web/CSS/Specificity
Re: The CSS Cascade (2020)
#9Can anyone explain how deep use of the CSS cascade is any different to OOP inheritance over composition? This is usually discouraged in OOP languages now because it quickly gets confusing and hard to maintain. Multiple inheritance is also usually discouraged for similar reasons, but not in CSS in the way you can combine classes together without restriction (with `!important` and specificity on top of this). And is CS…
One would necessarily have to generate the HTML, too, otherwise there are no guarantees, and even then the CSS—browser interplay might lead to broken styles.
Re: The CSS Cascade (2020)
#10I find her website to be difficult to skim and overview, something which is essential for technical reading, because more often than not you will want to return to a document you have previously read to remind yourself of a detail that you remember there, somewhere. It's probably not only related to the wacky sidebar, but more related to the main content style, headlines being too large and an overuse of colors and e…