at-rule

@document — CSS reference

Historical conditional rule based on document URL. It is not a portable author-side scoping mechanism. Use explicit classes and application routing.

Formal Syntax & Structure

css syntaxcss
@document url-prefix("https://example.test/") { #a { color:red } }

Working Example

Example Snippetcss
<!doctype html><html lang="en"><meta charset="utf-8"><title>@document</title><style>body{margin:8px;font:16px/20px sans-serif;color:black;background:white}@document url-prefix("https://example.test/") { #a { color:red } } #a{color:green}</style><body><p id="a">Example text</p></body></html>
CSS Reference