Monday, June 26, 2006

Domain Specific Class Selector

This is pretty cool...we stumbled across this syntax in a Digg Article about putting the menu back on the right.

docrule ::= "@-moz-document" S+ url-list "{" S* ruleset* "}"

url-list ::= url-item ( "," S* url-item )*

url-item ::= ( "url(" | "url-prefix(" | "domain(" ) URL ")" S*

where S is from the CSS2 tokenization, ruleset is from the CSS2 grammar,
and URL is like the production URI in the CSS2 tokenization except
without the 'url(' and ')'.

To define the three functions by example:

@-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"
*/
}

It basically allows you to have a class that only works on a specific domain. Of course it only works in Mozilla. Good use for the userContent.css file in FireFox.

Name
E-mail
Home page

Comment (Some html is allowed: a@href@title, b, blockquote@cite, em, i, strike, strong, sub, super, u)  

Enter the code shown (prevents robots):

Blog Posts by:

Currently Viewable:

My Twitter Updates

View Twitter Page