← Back to at-rules

CSS At-rule

@document

Structure

Applies styles only when the document matches a specific URL — a deprecated Firefox-only feature.

Syntax

@document url('https://example.com') { }

Example

@document url('https://example.com') { body { background: #000; } }

Common use cases

  • URL-specific styles in Firefox user stylesheets
  • Browser extension styling

Practical developer insight

@document was a Firefox-only experiment and is now deprecated — avoid using it in any production context.

Related