T.XL
T.XL

Reputation: 149

Is the firefox hack O.K to use?

I have used this hack to make css changes needed for firefox. It has worked, but when I validated the code I have the below error. Can I use the code below, or is there a better way?

751     Sorry, the at-rule @-moz-document is not implemented.
798     Parse Error }

/*********************************
FIRE FOX HACK TO FIX ERRORS
***********************************/
@-moz-document url-prefix() { 
  #rectangle {
       width: 1030px;
        right: -100px;
  }

} 

Upvotes: 2

Views: 498

Answers (1)

nashcheez
nashcheez

Reputation: 5183

Any CSS at-rule that starts with @-moz- is a Gecko-engine-specific rule i.e. it is a Mozilla-specific extension, not a standard rule.

The url-prefix rule here applies the contained style rules to any page whose URL starts with it. When used with no URL argument like @-moz-document url-prefix() it applies to ALL pages. That's effectively a CSS hack used to only target Gecko (Mozilla Firefox). All other browsers will ignore the styles.

Hence, you can perfectly use @-moz- styles to target only the Firefox browser.

See here for a list of other Mozilla-specific extensions.

See here for valid @moz document rules.

Upvotes: 1

Related Questions