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.

One of the ways to help get …


Manuel Matuzovic’s CSS Specificity Demo originally published on CSS-Tricks. You should get the newsletter.


This content originally appeared on CSS-Tricks and was authored by Chris Coyier

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.

Screenshot of the CSS Specificity Demo.

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.

To Shared LinkPermalink on CSS-Tricks


Manuel Matuzovic’s CSS Specificity Demo originally published on CSS-Tricks. You should get the newsletter.


This content originally appeared on CSS-Tricks and was authored by Chris Coyier


Print Share Comment Cite Upload Translate Updates
APA

Chris Coyier | Sciencx (2022-02-25T15:27:19+00:00) Manuel Matuzovic’s CSS Specificity Demo. Retrieved from https://www.scien.cx/2022/02/25/manuel-matuzovics-css-specificity-demo/

MLA
" » Manuel Matuzovic’s CSS Specificity Demo." Chris Coyier | Sciencx - Friday February 25, 2022, https://www.scien.cx/2022/02/25/manuel-matuzovics-css-specificity-demo/
HARVARD
Chris Coyier | Sciencx Friday February 25, 2022 » Manuel Matuzovic’s CSS Specificity Demo., viewed ,<https://www.scien.cx/2022/02/25/manuel-matuzovics-css-specificity-demo/>
VANCOUVER
Chris Coyier | Sciencx - » Manuel Matuzovic’s CSS Specificity Demo. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2022/02/25/manuel-matuzovics-css-specificity-demo/
CHICAGO
" » Manuel Matuzovic’s CSS Specificity Demo." Chris Coyier | Sciencx - Accessed . https://www.scien.cx/2022/02/25/manuel-matuzovics-css-specificity-demo/
IEEE
" » Manuel Matuzovic’s CSS Specificity Demo." Chris Coyier | Sciencx [Online]. Available: https://www.scien.cx/2022/02/25/manuel-matuzovics-css-specificity-demo/. [Accessed: ]
rf:citation
» Manuel Matuzovic’s CSS Specificity Demo | Chris Coyier | Sciencx | https://www.scien.cx/2022/02/25/manuel-matuzovics-css-specificity-demo/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.