Skip to content

[css-nesting] Nesting @media inside ::after not working #9153

Open
@mrshoekstra

Description

@mrshoekstra

I'm not sure if this is the implementation of Google Chrome or part of the spec (bug or feature).
I would like this to work, it seems this should work, but it doesn't:

Preferred (not working)

body {

	@media print {

	}

	@media screen {

		&::after {
			background: red;
			content: '';
			inset: 0;
			position: absolute;
			
			@media (width < 50rem) {
				background: blue;
			}
		}
	}
}

Working version with duplicate @media screen and &::after {

body {

	@media print {

	}

	@media screen {

		&::after {
			background: red;
			content: '';
			inset: 0;
			position: absolute;
		}
	}
	
	@media screen and (width < 50rem) {

		&::after {
			background: blue;
		}
	}
}

https://www.w3.org/TR/css-nesting-1/

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions