Colors in the text editor change when multiple @media queries are used in html style tag

Describe the Bug

Colors in the text editor change when multiple @media queries are used in html style tag

Steps to Reproduce

Create and html file
Add more than 1 @media queries

Expected Behavior

Colors in text editor shouldn’t change

Screenshots / Screen Recordings

Operating System

MacOS

Version Information

Version: 3.3.22
VSCode Version: 1.105.1
Commit: 38a27120cfc7419a5efa38420665eaeeed1e7b30
Date: 2026-05-07T07:47:13.552Z
Layout: editor
Build Type: Stable
Release Track: Default
Electron: 39.8.1
Chromium: 142.0.7444.265
Node.js: 22.22.1
V8: 14.2.231.22-electron.0
OS: Darwin arm64 25.4.0

Does this stop you from using Cursor

No - Cursor works, but with this issue

Hey, thanks for the report. This is a known limitation of the CSS TextMate grammar that Cursor inherits from VS Code, and you can reproduce it there the same way. It’s not Cursor-specific, so we won’t ship a fix on our side. We’re waiting for an upstream fix.

Main tracking issue in VS Code: https://github.com/microsoft/vscode-css/issues/9. VS Code is currently experimenting with a tree-sitter CSS tokenizer that should fix this, and there’s also a community PR to update the grammar.

As a workaround, you can install the CSS Nesting Syntax Highlighting extension: CSS Nesting Syntax Highlighting - Visual Studio Marketplace. It highlights these cases more correctly.