Skip to main content
CSS-Tricks
  • Articles
  • Alamanac
  • Guides
  • Videos
  • Books
  • Newsletter
Search

Articles Tagged
specificity

19 Articles
{
,

}
Direct link to the article :has is an unforgiving selector
:has :is :where specificity

:has is an unforgiving selector

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 …

Avatar of Geoff Graham
Geoff Graham on Jan 11, 2023
Direct link to the article Taming the Cascade With BEM and Modern CSS Selectors
:has :is :where bem cascade specificity

Taming the Cascade With BEM and Modern CSS Selectors

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 …

Avatar of Liam Johnston
Liam Johnston on Nov 21, 2022 (Updated on Jan 17, 2023)
Direct link to the article Using CSS Cascade Layers to Manage Custom Styles in a Tailwind Project
cascade layers specificity tailwind

Using CSS Cascade Layers to Manage Custom Styles in a Tailwind Project

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 …

Avatar of Ollie Williams
Ollie Williams on Aug 24, 2022
Direct link to the article Manuel Matuzovic’s CSS Specificity Demo
specificity

Manuel Matuzovic’s CSS Specificity Demo

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.…

Avatar of Chris Coyier
Chris Coyier on Feb 25, 2022
Direct link to the article Don’t Fight the Cascade, Control It!
:is :where cascade cascade layers custom properties data attributes specificity

Don’t Fight the Cascade, Control It!

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 …

Avatar of Mads Stoumann
Mads Stoumann on Jan 10, 2022 (Updated on Jan 11, 2022)
Direct link to the article An Interview With Elad Shechter on “The New CSS Reset”
interview reset specificity

An Interview With Elad Shechter on “The New CSS Reset”

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 …

Avatar of Elad Shechter
Elad Shechter on Oct 19, 2021 (Updated on Feb 27, 2022)
Direct link to the article Cascade Layers
@layer cascade specificity

Cascade Layers

There is a new thing coming in CSS: @layer. …

Avatar of Chris Coyier
Chris Coyier on Sep 21, 2021 (Updated on Jan 6, 2022)
Direct link to the article Using the Specificity of :where() as a CSS Reset
:where specificity

Using the Specificity of :where() as a CSS Reset

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 …

Avatar of Mojtaba Seyedi
Mojtaba Seyedi on Jul 12, 2021
Direct link to the article Should DevTools teach the CSS cascade?
cascade DevTools specificity

Should DevTools teach the CSS cascade?

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 …

Avatar of Chris Coyier
Chris Coyier on May 21, 2021
Direct link to the article Hide Scrollbars During an Animation
animation scrollbars specificity

Hide Scrollbars During an Animation

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 …

Avatar of Chris Coyier
Chris Coyier on Jun 24, 2020 (Updated on Sep 15, 2021)
Direct link to the article “weeds of specificity”
specificity

“weeds of specificity”

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

…
Avatar of Chris Coyier
Chris Coyier on Mar 13, 2020
  • 1
  • 2
  • Older

CSS-Tricks is powered by DigitalOcean.

Keep up to date on web dev

with our hand-crafted newsletter

DigitalOcean
  • About DO
  • Cloudways hosting
  • Legal stuff
  • Get free credit!
CSS-Tricks
  • Write for us!
  • Advertise with us
  • Contact us
Social
  • RSS Feeds
  • CodePen
  • Mastodon
  • X
Back to Top