

Manuel Matuzovic's CSS Specificity Demo | CSS-Tricks - CSS-Tricks
source link: https://css-tricks.com/manuel-matuzovics-css-specificity-demo/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Manuel Matuzovic’s CSS Specificity Demo
Chris Coyier on
Feb 25, 2022
helps developers build fast.
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 a grasp of CSS specificity is thinking terms of “what beats what” or how strong the specificity is. Manuel Matuzovic has a helpful interactive step-by-step demo. You keep clicking the “Add selector” button, and the CSS shown (and applied to the page) changes with ever-increasingly-strong selectors applied to the body that change the background-color
. At the end, it veers into not-really-selectors trickery, like using @keyframes
to override things.
More specificity practice
If you enjoyed the trickery at the end, check out Francisco Dias’ A Specificity Battle!, an article we published a few years back that does a back-and-forth styling battle with nineteen steps “selecting” the same element to re-style it. CSS is cray sometimes.
Recommend
-
34
When working with CSS conflicting styles can be a thorn in your side, especially when you don’t know where the conflict is originating from. This tutorial will give you a firm understanding of CSS specificity which will h...
-
36
In this article, we’re going to review some of the most fundamental concepts of CSS. The cascade (the ‘C’ in C ascading S tyle S heets), we’ll also l...
-
12
:where() has a cool specificity trick, too. Chris Coyier on Mar 29, 2021 (Updated on Apr 1, 2021) Take the pain out of building site sea...
-
9
CSS cascade & specificity Link – Jun 8th 2021 ...
-
9
CSS Nesting, specificity and you Kilian ValkhofBuilding tools that make developers awesome. Search term CSS Nesting, specificity and you
-
6
Comparing CSS Specificity values Kilian ValkhofBuilding tools that make developers awesome. Search term Comparing CSS Specificity values
-
3
Day 16: the specificity of :has() posted on October 17., 2022 It’s time to get me up to speed with modern CSS. There’s so much new in CSS that I know too little about....
-
8
Manuel Matuzovic: max() Trickery Let’s put those CSS skills to work! Claim
-
9
This is the fourth part of the Top CSS Frameworks of 2021 report. Read the previous reports about the file sizes,
-
6
Day 45: the specificity of ::slotted() content posted on November 25., 2022 It’s time to get me up to speed with modern CSS. There’s so much new in CSS that I know too...
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK