W3C home > Mailing lists > Public > www-style@w3.org > December 2003

Re: [css3] URI selectors

From: Tantek Çelik <tantek@cs.stanford.edu>
Date: Mon, 08 Dec 2003 18:39:05 -0800
To: Boris Zbarsky <bzbarsky@mit.edu>, Chris Moschini <cmoschini@myrealbox.com>
Cc: <www-style@w3.org>
Message-ID: <BBFA7593.31ABB%tantek@cs.stanford.edu>

On 12/8/03 12:50 PM, "Boris Zbarsky" <bzbarsky@MIT.EDU> wrote:

> Chris Moschini wrote:
>> For this reason, why not offer as part of the CSS3 spec a selector that can
>> differentiate
>> between URIs? Something like:
>> uri( "www.w3c.org" ), url( "www.w3.org" ) { font-size: 150%; }
>> It could be a huge boon to accessibility.
> It would be much easier for the UA to implement per-site user
> stylesheets...  The UA can then even use a definition of "site" that's
> somewhat better than a direct URI match (eg based on document.domain
> amongst other things).

It is doubtful that the UA will understand what defines the "site" better
than the author of the site.

Thus an author technology is preferable to a UA-only technology.

In addition, any such author technology can be overridden by the user in
their user style sheet, or by UA settings which result in synthesized user
style sheet rules.

This kind of functionality was previously proposed, albeit using an at-rule
(which I think is preferable to a selector -- as selectors *should* be
limited to aspects of elements rather than aspects of the document (like its
URL), viewport, media etc.)

Todd Fahrner proposed @scope in 1999.  It works like @media except based on
the URL rather than the media type.

[CSS WG only link]

Here are the essential bits (I don't think Todd won't mind that I reposted
this).  I still think this is a good proposal, and think it may find its way
to either the CSS3 Cascading or CSS3 Syntax modules (more likely Cascading).


From: Todd Fahrner
Date: Wed, 10 Mar 1999 09:11:00 -0800

How about an "@scope" feature to limit application of the enclosed rules to
the specified scope? e.g.:

@scope url("http://www.apple.com/")
    background: red;

@scope url("http://www.ibm.com/")
    background: blue;

Now these rules would apply to all subdirectories inside those urls as well.

You should also be able to do stuff like this:

@scope url("/ads/"), url("http://www.yahoo.com/ad1.jpg")
    display: none;

or this:

@scope url("http://intranet.mycompany.com/")
    background: no-repeat fixed url("confidential.png");

or this:

@scope url("https:")
    background: no-repeat fixed url("securehttp.png");

or this:

@scope url("file:")
    background: no-repeat fixed url("local.png");

Obviously useful for user style sheets, as it suggests a CSS framework for
UAs to apply certain rules only to certain domains, whose authors may have
some disagreeable notions of taste or usability. With some sort of
expression for "the current domain", would enable transient application of
bits of corrective or "utility" CSS.


Received on Monday, 8 December 2003 21:40:27 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:27:10 UTC