🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › CSS › Guides › Nesting › Using
Using CSS nesting - CSS | MDN
November 7, 2025 - The CSS nesting module allows you to write your stylesheets so that they are easier to read, more modular, and more maintainable. As you are not constantly repeating selectors, the file size can also be reduced.
🌐
W3Schools
w3schools.com › cssref › sel_nesting.php
CSS Nesting (&) Selector
The CSS nesting (&) selector is used to apply styles for an element within the context of another element.
Discussions

CSS nesting: use with caution
If you're going deeper than 2 levels in nesting, you should rethink what you're doing. Inheritance is a bitch. More on reddit.com
🌐 r/css
46
10
February 13, 2025
html - Is nesting possible with CSS (like it is with SASS)? - Stack Overflow
This might be a very stupid question, but I couldn't find anything and it seems so obvious: is nesting with CSS possible like with SASS? For example, I want to define a h1 tag on a certain page, s... More on stackoverflow.com
🌐 stackoverflow.com
css selectors - Nesting CSS classes - Stack Overflow
Can't find mention of @nest anywhere. What is it? 2025-01-14T20:40:15.993Z+00:00 ... Not possible with vanilla CSS. More on stackoverflow.com
🌐 stackoverflow.com
CSS nesting improves with CSSNestedDeclarations
Create your account and connect with a world of communities · Anyone can view, post, and comment to this community More on reddit.com
🌐 r/Frontend
1
25
October 8, 2024
🌐
Reddit
reddit.com › r/webdev › is it safe to use native css nesting
r/webdev on Reddit: Is it safe to use native css nesting
February 8, 2024 -

I’ve been keeping an eye on native css nesting for a while now and I was wondering if you would consider it a safe feature to use yet.

Here is the support on can I use

https://caniuse.com/css-nesting

I’m talking about the clean version that doesn’t use the & prefix.

Clean css nesting without sass please tell me the future is here.

🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › CSS › Guides › Nesting
CSS nesting - CSS | MDN
November 18, 2025 - The CSS nesting module defines a syntax for nesting selectors, providing the ability to nest one style rule inside another, with the selector of the child rule relative to the selector of the parent rule.
🌐
Chrome Developers
developer.chrome.com › docs › css-ui › css-nesting
CSS Nesting | Chrome for Developers
March 8, 2023 - CSS nesting allows you to define styles for an element within the context of another selector.
🌐
W3C
w3.org › TR › css-nesting-1
CSS Nesting Module Level 1
January 22, 2026 - This module describes support for nesting a style rule within another style rule, allowing the inner rule’s selector to reference the elements matched by the outer rule. This feature allows related styles to be aggregated into a single structure within the CSS document, improving readability ...
🌐
LogRocket
blog.logrocket.com › home › native css nesting: what you need to know
Native CSS nesting: What you need to know - LogRocket Blog
June 4, 2024 - That way, if we invert the above CSS style and replace every & with the parent selector, we will get back the initial CSS structure. Let’s take another example. This time, we’ll look at compound selectors like the one below: ... As we can see, replacing the & with the parent selector, h1, gives us back the h1.header. Whenever we add a selector — in this case, a class selector — on the same element, we must ignore the space between & and the selector. Let’s take another example by rewriting the following style rules using nested classes:
Find elsewhere
🌐
Piccalilli
piccalil.li › blog › css-nesting-use-with-caution
CSS nesting: use with caution - Piccalilli
January 30, 2025 - Nesting was a solution to a developer problem, not an end-user problem. Nesting had no business being a native feature of the browser. As a feature of CSS pre-processors (or post-processors when you consider PostCSS) I think nesting is easier to swallow because it only impacts the developer.
🌐
Reddit
reddit.com › r/css › css nesting: use with caution
r/css on Reddit: CSS nesting: use with caution
February 13, 2025 - I like to nest media queries and pseudo-classes/elements, that's it. ... You can also use it for `@supports` and some other `@at-rules` which is pretty cool! ... Didn't know you can put them inside selectors. ... You can, which is pretty convenient! ... Atomic CSS because while working as a freelancer for an agency, I watched their junior developer panic at the prospect of modifying a utility class-ridden component because they didn’t dare touch it, out of fear.
🌐
Can I Use
caniuse.com › css-nesting
CSS Nesting | Can I use... Support tables for HTML5, CSS3, etc
CSS nesting provides the ability to nest one style rule inside another, with the selector of the child rule relative to the selector of the parent rule.
🌐
Kilian Valkhof
kilianvalkhof.com › home › css & html › the gotchas of css nesting
The gotchas of CSS Nesting | Kilian Valkhof
June 13, 2023 - When it exits the nested media query, it adds the rest of the properties to the original ruleset again until that is exited. ... Now from this CSS, it makes more sense that red wins. It has the same specificity but it comes after the first rule so it wins.
🌐
web.dev
web.dev › learn › css › nesting
Nesting | web.dev
August 21, 2025 - In Sass, writing &p would append the parent selector to the nested type selector and the result would be .featurep. CSS conditional group rules like @container, @media, @supports, and @layer can also be nested.
Top answer
1 of 4
6

No, that's not possible now, that's why SASS lists nesting as a feature.

2 of 4
4

Well, as @destroy already answered, you cannot have nested selectors using CSS, that's why developers choose LESS and SASS preprocessors. The best thing you can do to minimize the CSS is my grouping common properties like

div, p, i {
   color: #f00;
   /* All the three elements will have the same color */
}

You can also declare the base properties right in the parent selector so that they can be easily inherited and you don't have to call them again and again on each..

body {
   font-size: 14px;
   font-family: Arial;
   color: #515151;
}

The above properties will be easily inherited by elements such as p, so you won't have to declare the font-family or font-size each time unless and until you want to have a different font-family for a particular element which can be over ridden by using a more specific selector like

.class_name p {
   font-family: Open Sans, Arial;
}

You do have universal selectors which will also ease up over lengthy selectors, like say you want to color red all the elements nested inside a specific element having a class called .class_name so instead of doing

.class_name p, .class_name div, .class_name fieldset {
   /* This is really bad */
}

Instead you can write the above as

.class_name * {
   /* Much better */
}

Conclusion : Learn CSS Selectors, that's the only way you can figure out and you can optimize your CSS yourself, while selectors totally depend on the DOM, so there are no pre defined techniques but you should keep the selectors simple, not over complicated, else you will end up writing more and more specific rules which will lead to more 100 line of crappy CSS...


Also, here's an handy tool by Google you can always use to optimize the performance.

🌐
Ishadeed
ishadeed.com › article › css-nesting
CSS Nesting
November 19, 2023 - In Safari TP 179+ and Chrome Canary 120, the ampersand symbol is no longer required for nesting elements. ... The only problem is that you have to fallback on the previous version of the spec, which must include the ampersand & symbol. The :active, :focus, and :hover is CSS pseudo-classed that are activated via user action.
🌐
Creatures
creatures.sh › blog › getting-started-with-css-nesting
Getting started with CSS Nesting | creatures.sh
August 12, 2023 - CSS Nesting is a new feature that allows you to nest selectors inside other selectors. Nesting helps by reducing repetition, reducing the file size, better file organization and easier refactoring.
🌐
Pootlepress
pootlepress.com › 2023 › 07 › beginners-guide-to-css-nesting
The Absolute Beginner’s Guide to CSS Nesting | Pootlepress
July 29, 2023 - Introduction CSS nesting allows you to nest CSS selectors within other selectors. This can help keep your CSS neat and organized. What is CSS nesting? CSS nesting is a feature that allows you to nest CSS selectors within other CSS selectors to create a relationship between the nested selectors.
🌐
Tabatkins
tabatkins.github.io › specs › css-nesting
CSS Nesting Module Level 3
April 3, 2023 - This module describes support for nesting a style rule within another style rule, allowing the inner rule’s selector to reference the elements matched by the outer rule. This feature allows related styles to be aggregated into a single structure within the CSS document, improving readability ...
🌐
JetBrains
blog.jetbrains.com › webstorm › 2023 › 08 › css-nesting
Exploring the Power of CSS Nesting: Simplifying Styling and Enhancing Readability | The WebStorm Blog
August 14, 2023 - In some cases, nesting might also give a big reduction in code size. Instead of specifying the parent element over and over, nesting lets you remove that part from your code. Looking at example 1 and example 2 we can see that nesting lets us write more concise CSS code.
🌐
web.dev
web.dev › articles › css nesting improves with cssnesteddeclarations
CSS nesting improves with CSSNestedDeclarations | Articles | web.dev
Furthermore, having a CSSNestedDeclarations instance doesn't introduce any of the nasty side-effects the other, now discarded, potential solutions caused: The nested declarations rule matches the exact same elements and pseudo-elements as its parent style rule, with the same specificity behavior. Proof of this is reading back the cssText of the CSSStyleRule.