hhmx.de

Föderation EN Fr 20.09.2024 15:11:32

OK, here is a weird CSS discovery. Media queries apparently can go around just a single property and value, not necessarily a whole rule.

That is:

@media ... { p { color:green } }

works as expected, but

p { @media ... { color: green } }

works as well!

Is this _supposed_ to work? Does everyone else use this all the time and I'm the last to find out? I had no idea this worked; I assumed you had to wrap whole rules only!

kryogenix.org/random/media-que demonstrates.

Medien: 1

Föderation EN Fr 20.09.2024 15:13:18

@sil Isn't this part of nesting?

Föderation EN Fr 20.09.2024 15:13:43

@kjhank could be! maybe it's always worked and I just didn't know!

Föderation EN Fr 20.09.2024 15:15:36

@sil that’s css nesting

Föderation EN Fr 20.09.2024 15:17:11

@cheeaun aha, yes, @kjhank said so as well.

"Properties can be directly included inside a nested at-rule, acting as if they were nested in a & {...} block."

Today I learned!

developer.mozilla.org/en-US/do