@-moz-document

« CSS « CSS Reference « CSS Reference:Mozilla Extensions

Summary

The @-moz-document rule is a Gecko-specific at-rule that restricts the style rules contained within it based on the URL of the document. It is designed primarily for user style sheets. A @-moz-document rule can specify one or more matching functions. If any of the functions apply to a URL, the rule will take effect on that URL.

The functions available are:

  • url(), which matches an exact URL
  • url-prefix(), which matches if the document URL starts with the value provided
  • domain(), which matches if the document URL is on the domain provided (or a subdomain of it)
  • regexp(), which matches if the document URL is matched by the regular expression provided. The expression must match the entire URL.

Gecko 6.0 note
(Firefox 6.0 / Thunderbird 6.0 / SeaMonkey 2.3)

Support for the regexp()function was added in Gecko 6.0 (Firefox 6.0 / Thunderbird 6.0 / SeaMonkey 2.3) .

Syntax

The values provided to the url(), url-prefix(), and domain() functions can optionally be enclosed by single or double quotes. The values provided to the regexp() function must be enclosed in quotes.

Escaped values provided to the regexp() function must additionally escaped from the CSS. For example, a . (period) matches any character in regular expressions. To match a literal period, you would first need to escape it using regular expression rules (to \.), then escape that string using CSS rules (to \\.).

Examples

You can put this into your userContent.css file:

reference to undefined name 'syntax' Exception of type 'MindTouch.Deki.Script.Runtime.DekiScriptUndefinedNameException' was thrown. (click for details)

Specifications

Browser compatibility

Available since Mozilla 1.8 / Firefox 1.5.

Tags (3)

Edit tags

Attachments (0)

 

Attach file