CSS

Collections

Pseudo-class

Cascade Precedence

Layers

Hello, CSS Cascade Layers

To overcome the fights with the cascade and specificity issues, we need to be careful about where to write a specific CSS block. In small projects, this can be okay, but for large ones, it’s a time-consuming task. As a result, we started to see different methods to help us organize our CSS better and thus reducing the cascade issues. The first three that came to my mind are the BEM (Block, Element, Modifier), Smacss by Jonathan Snook and Inverted Triangle CSS by Harry Roberts.

In this article, we’ll explore how cascade layers work, and how they will help us write CSS with more confidence, along with use-cases and examples.

History

!important

CSS co-designer here.
!important was added for one reason only: laws in the US that require certain text to be in a given font-size. !important stops the cascade from changing it.
Anything else is probably misuse, and a sign you may not understand the cascade properly.

SVG

Where, When, And When NOT To Use SVG!

  • When Shouldn’t We Use SVG?
    • Presentational monochrome images such as flat icons. Webfonts can be cached, the two modern formats of WOFF and WOFF2 compress much smaller than gzipping minified SVG.
  • Is It Presentational And/Or Decoration? Then Don’t Put It In The Markup!
  • If Not In The Markup, Where?
    • Your stylesheet. As a background-image.

Understanding SVG Paths

Have It All: External, Styleable, & Scalable SVG

SVG triangle of compromise (resolved)

Displaying an external SVG with the <use> tag

  • stylable
  • cacheable
  • dimensional

Functions

CSS Image fragments - image()

.hero {
  background-image: image("images/my-image.jpg#xywh=150,50,500,300");
}

Grid

Styles

columns


Children
  1. 10 CSS Tricks That Greatly Improve User Experience
  2. A (more) Modern CSS Reset
  3. A Complete Guide to CSS Cascade Layers
  4. An Interactive Guide to CSS Grid
  5. An Interactive Guide to Flexbox
  6. Avoiding <img> layout shifts: aspect-ratio vs width & height attributes
  7. CONDITIONALLY ADAPTIVE CSS. BROWSER BEHAVIOR THAT MIGHT IMPROVE YOUR PERFORMANCE
  8. CSS Performance
  9. CSS about font
  10. CSS about scroll
  11. CSS for printing to paper
  12. CSS in JS
  13. CSS snippets
  14. CSs tools
  15. Cube CSS
  16. Defensive CSS
  17. Flexbox Dynamic Line Separator
  18. Flexibly Centering an Element with Side-Aligned Content
  19. Interesting CSS
  20. Inverted Triangle Architecture For CSS (ITCSS)
  21. Lesser-Known And Underused CSS Features In 2022
  22. Modern CSS in Real Life
  23. My Custom CSS Reset
  24. Negative Animation Delay
  25. New CSS Features In 2022
  26. Tailwind is an Anti-Pattern
  27. The wasted potential of CSS attribute selectors
  28. Understanding Layout Algorithms
  29. Using CSS to Enforce Accessibility
  30. What order do files load in the browser?
  31. Writing Logic in CSS
  32. focus-visible
  33. query
  34. style-a-parent-element-based-on-its-number-of-children-using-css-has