There's more...

We can see that Sass nesting can go many levels deep, but just like many powerful features, it can be taken too far. Deeply nested selectors can cause problems, as they become difficult to read and potentially too specific for its context. Although many developers disagree on how many layers of nesting are too many, the general rule of thumb is using no more than 3-4 layers, depending on the application's styling complexity. Luckily, in Angular, we have other tools available to assist with limiting selector specificity besides Sass nesting, such as component styles.

When deciding whether to nest a selector in Sass or not, it may be worth checking the specificity needed to apply the selector. In cases where there isn't much difference in the specificity between two elements, it's likely that nesting isn't really required to get the desired outcome. However, in cases where there is a large difference in specificity, nesting can be a very useful tool to help close that gap in selector specificity.

You can visit the following link for more information:
https://developer.mozilla.org/en-US/docs/Web/CSS/Specificity

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.142.95.153