CSS by T. Afif :verified: on Nostr: CSS Nesting is cool and using the "&" is a lifesaver BUT be careful. There's a ...
CSS Nesting is cool and using the "&" is a lifesaver BUT be careful. There's a gotcha!
⚠️ "&" in CSS is different from the one in Sass ⚠️
Your Sass code won't work the same way if you use it as a CSS code. CSS Nesting introduces the `:is()` part which make the selection different.
Here are two demos that looks similar
Using CSS: https://codepen.io/t_afif/pen/zYbbmbb
Using Sass: https://codepen.io/t_afif/pen/zYbbMKg
But the result is not the same!
Online Version: https://css-tip.com/nesting-selector/
#CSS #HTML
⚠️ "&" in CSS is different from the one in Sass ⚠️
Your Sass code won't work the same way if you use it as a CSS code. CSS Nesting introduces the `:is()` part which make the selection different.
Here are two demos that looks similar
Using CSS: https://codepen.io/t_afif/pen/zYbbmbb
Using Sass: https://codepen.io/t_afif/pen/zYbbMKg
But the result is not the same!
Online Version: https://css-tip.com/nesting-selector/
#CSS #HTML
![](https://cdn.masto.host/frontendsocial/media_attachments/files/111/957/988/220/120/741/original/b1e8515e827d3eeb.png)