How To Define Mozilla Specific CSS

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.

,
Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • del.icio.us
  • Technorati
  • digg
  • Reddit
  • SphereIt
  • DotNetKicks
  • YahooMyWeb

5 Responses to “How To Define Mozilla Specific CSS”


  1. 1 Georgi Feb 25th, 2007 at 5:52 pm

    And this code is valid CSS?
    http://jigsaw.w3.org/css-validator/

  2. 2 Vesy Feb 28th, 2007 at 5:10 pm

    It is not, but it’s a good solution when there’s no other way to achieve particular goal.

    Everyone has the opportunity to make the choice: poor design in Firefox or valid CSS.

  3. 3 anud Oct 14th, 2007 at 9:54 am

    well my site uses various browsers and is being decorated using a lot of css, infact 12 css per page. now some css works fine in ie 6 but not in mozilla, so i wanted to jnw if you know any mozilla speciic css tags, i know one ie HTML > BODY , but the problem with this one is that, both IE 7 and mozilla recognises that , but not IE6, i want only for mozilla.

  4. 4 Vesy Oct 15th, 2007 at 1:29 pm

    Have you tried Mozilla CSS Extensions?

  1. 1 » Browser Compatibility Tools - Mega List of Browser Checkers to Check Your Web Sites for Browser SupportWeb Design Resources Blog & Graphics Blog with Lists of Web Site Design Tools Pingback on May 22nd, 2008 at 12:40 am

Leave a Reply




Google

Blogroll


Blogroll Me!

Enter your email address:

Delivered by FeedBurner







Academics Blogs - Blog Top Sites