June 2025
Beginner
817 pages
31h 30m
English
An enormous relief when writing SCSS documents is the use of a nesting of selectors (selector nesting), as they occur in the HTML document. However, it’s important to keep the nesting within limits to avoid overloading the specificity of CSS, which can lead to a performance brake. I recommend a nesting of two to maximum three levels here. Here’s a simple example of what such a nesting of selectors looks like and what the CSS preprocessor makes of it. Here, the selectors p and h1 are written inside the my-article class.
|
SCSS File |
CSS File |
|---|---|
|
....my-article { width: 30rem; background-color: $color-primary; color: $color-primary-font; padding: 0.1em; margin-bottom: $spacing-std; border-radius: 5px; h1 { ... |
Read now
Unlock full access