by frosted-flakes · 3y ago · 0 comments
.some-class {
background: blue;
&:hover {background: red}
border: 1px solid;
&:active {border: 1px dashed}
padding: 16px;
display: flex;
gap: 8px;
& > * {
color: red;
}
}
And it would be a pity if that wasn't allowed.The reason I ask is because I seem to remember an early proposal not allowing this, but I can't find where I read it.
> When a style rule contains both declarations and nested style rules or nested conditional group rules, the declarations must come first, followed by the nested rules. Declarations occuring[sic] after a nested rule are invalid and ignored.
[1] https://www.w3.org/TR/2021/WD-css-nesting-1-20210831/#mixing
Fortunately, this has been changed in the most recent proposal[2]:
> When a style rule contains both declarations and nested style rules or nested conditional group rules, all three can be arbitrarily mixed. However, the relative order of declarations vs other rules is not preserved in any way.