Can you NEST CSS Selectors just like HTML elements/tags?

Just started learning CSS and a thought popped up.
Tried doing it, a selector in a selector, in my case a paragraph and a span-span (I love calling it that) tag.
Didn’t work

However when I separated the two selectors into two separate groups instead of nesting into each other it worked.

I know this question might sound a little weird but hey I am a crew member of the Future Pirate King so weird is the new normal for me ;D wink but are there any exceptions where you can nest selectors inside one another?

You can use SASS, this allows for nested css selectors, css doesn’t support nested css selectors

1 Like

Oh, didn’t know that SASS was an extension language of CSS. Thanks! :smiley:

Once you wrote your SASS code, you need to use sass to “compile” your code into understandable css code. The browser only understands css, not sass

Thanks for the explanation. Will definitely keep that in mind :slight_smile:

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.