CSS @document At-Rule
@document at-rule can be used to restrict styles to a single page or a set of pages.
@document at-rule is a nested at-rule that accepts a list of URLs. Any styles provided are applied only to the specified URLs.
@document at-rule is primarily intended to be used with user style sheets, it can also be used in author style sheets.
Here's an example of using the
The above example uses the
url() function to apply styles to a specific page. Other functions are available that allow you to specify a group of pages, rather than just one. These are listed below.
The URL value/s can be provided by any of the following functions.
Specifies the exact
<url>of the document to apply the styles to.
Allows you to provide one or more URLs by specifying the first part of the URL.
Allows you to specify the domain with which the styles are applied.
This function allows you to specify the document/s using a regular expression.
Providing a List of Functions
You can provide a list of values using any of the accepted functions. In other words, you're not limited to just one function or another.
Here's an example of using all of the above functions in one declaration: