Search
:has is an unforgiving selector
11.1.2023
A little thing happened on the way to publishing the CSS :has() selector to the ol’ Almanac. I had originally described :has() as a “forgiving” selector, the idea being that anything in its argument is evaluated, even if one or …
:has is an unforgiving selector originally...
Taming the Cascade With BEM and Modern CSS Selectors
21.11.2022
BEM. Like seemingly all techniques in the world of front-end development, writing CSS in a BEM format can be polarizing. But it is – at least in my Twitter bubble – one of the better-liked CSS methodologies.
Personally, I think …
Taming the Cascade With BEM and Modern CSS Selectors...
Using CSS Cascade Layers to Manage Custom Styles in a Tailwind Project
24.8.2022
If a utility class only does one thing, chances are you don’t want it to be overridden by any styles coming from elsewhere. One approach is to use !important to be 100% certain the style will be applied, regardless of …
Using CSS Cascade Layers to Manage Custom Styles in a Tailwind Project...
Manuel Matuzovic’s CSS Specificity Demo
25.2.2022
If you’re looking for a primer on CSS specificity, we’ve got that. And if you’re trying to get ahead of the game, you should be aware of CSS Cascade Layers as well.
One of the ways to help get …
Manuel Matuzovic’s CSS Specificity Demo originally published...
A Complete Guide to CSS Cascade Layers
21.2.2022
This is your complete guide to CSS cascade layers, a CSS feature that allows us to define explicit contained layers of specificity, so that we have full control over which styles take priority in a project without relying on specificity …
A Complete Guide to CSS Cascade Layers originally...
Don’t Fight the Cascade, Control It!
10.1.2022
If you’re disciplined and make use of the inheritance that the CSS cascade provides, you’ll end up writing less CSS. But because our styles often comes from all kinds of sources — and can be a pain to structure and …
Don’t Fight the Cascade, Control It! originally published...
An Interview With Elad Shechter on “The New CSS Reset”
19.10.2021
Hey folks! Elad reached out to me to show me his new CSS reset project called the-new-css-reset. It’s quite interesting! I thought a neat way to share it with you is not only to point you toward it, but …
The post An Interview With Elad Shechter on “The New CSS Reset” appeared...
Cascade Layers?
21.9.2021
There is a new thing coming in CSS: @layer. As with all new things, it takes time to really wrap your head around it. And despite me tapping at my keyboard about it, full disclosure, I’m not sure my …
The post Cascade Layers? appeared first on CSS-Tricks. You can support CSS-Tricks...
CSS Nesting, specificity, and you
10.8.2021
Here’s Kilian Valkhof on CSS nesting which isn’t available in browsers yet, but will be soon. There are a few differences he notes between CSS nesting and nesting in Sass or Less though. Take, for example, the following code:
div
…
The post CSS Nesting, specificity, and you appeared...
Using the Specificity of :where() as a CSS Reset
12.7.2021
I don’t know about you, but I write these three declarations many times in my CSS:
ul {
padding: 0;
margin: 0;
list-style-type: none;
}
You might yell at me and say I can just put those in my CSS …
The post Using the Specificity of :where() as a CSS Reset appeared first on CSS-Tricks....
Should DevTools teach the CSS cascade?
22.5.2021
Stefan Judis, two days before I mouthed off about using (X, X, X, X) for talking about specificity, has a great blog post not only using that format, but advocating that browser DevTools should show us that value by …
The post Should DevTools teach the CSS cascade? appeared first...
Let’s use (X, X, X, X) for talking about specificity
4.5.2021
I was just chatting with Eric Meyer the other day and I remembered an Eric Meyer story from my formative years. I wrote a blog post about CSS specificity, and Eric took the time to point out the misleading nature …
The post Let’s use (X, X, X, X) for talking about specificity appeared first...
:where() has a cool specificity trick, too.
30.3.2021
There is a lot of hype on the :is() pseudo-selector lately, probably because now that Safari 14 has it, it’s supported across all the major browsers. You’ve got Miriam tweeting about it, Kevin Powell doing a video, Šime …
The post :where() has a cool specificity trick, too....
Collective #614
16.7.2020
The WET Codebase * zerodivs.com * Super Expressive * Webwaste * What is CSS Specificity? * 3D Radio
The post Collective #614 appeared first on Codrops
Hide Scrollbars During an Animation
24.6.2020
CSS still can’t animate to auto dimensions.
.dropdown {
transition: 0.2s;
height: 0;
}
.dropdown.open {
/* the height will change, but it won't animate. */
height: auto;
}
There is JavaScript trickery you can try. Brandon Smith outlined several techniques here a little while back....
Using Custom Property “Stacks” to Tame the Cascade
22.6.2020
Since the inception of CSS in 1994, the cascade and inheritance have defined how we design on the web. Both are powerful features but, as authors, we’ve had very little control over how they interact. Selector specificity and source order provide some minimal “layering” control...
CSS :is() and :where() are coming to browsers
10.6.2020
Šime Vidas with the lowdown on what these pseudo-selectors are and why they will be useful:
:is() is to reduce repetition¹ of parts of comma-separated selectors.
:where() is the same, but nothing inside it affects specificity. The example of wrapping :where(:not()) is really great, as now there...
“weeds of specificity”
13.3.2020
Lara Schenck:
[...] with WordPress child themes, you are all but guaranteed to get into the weeds of specificity, hunting around theme stylesheets that you didn’t author, trying to figure out what existing declaration is preventing you from applying a new style, and then figuring out the least...
What’s the Difference Between Width/Height in CSS and Width/Height HTML attributes?
24.1.2020
Some HTML elements accept width and height as attributes. Some do not. For example:
<!-- valid, works, is a good idea --<img width="500" height="400" src="..." alt="..."<iframe width="600" height="400" src="..."</iframe<svg width="20" height="20"</svg<!-- not valid...
Amelia Wattenberger’s The CSS Cascade
23.1.2020
If you're on a small screen, remind yourself to check it out on a big screen when you have the chance.
Did you know that styles from an active transition beat !important rules, but styles from an active animation do not? I definitely did not.
Or that there are "origins" that are almost like...