Avaricesoft’s Weblog

Just another WordPress.com weblog

How To Define Mozilla Specific CSS

Posted by avaricesoft on July 8, 2008

Today I found a great approach for defining Mozilla specific styles without using Mozilla CSS extentions. The only thing needed is to put all Mozilla specific CSS definitions in a “@-moz-document” block and specify the url, url-prefix or domain to which pages the styles have to be applied:

@-moz-document url(http://www.w3.org/),
               url-prefix(http://www.w3.org/Style/),
               domain(mozilla.org)
{
  /* CSS rules here apply to:
     + The page "http://www.w3.org/".
     + Any page whose URL begins with "http://www.w3.org/Style/"
     + Any page whose URL's host is "mozilla.org" or ends with
       ".mozilla.org"
   */

  body { ... }
}

Browser compatibility
Available since Mozilla 1.8 / Firefox 1.5.

You can read more about this on Mozilla developer center website.

Now go and learn more about Mozilla CSS extentions.

regards,

www.avaricesoft.com

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <pre> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>