Re: Another approch to style hyperlinks

Bert Bos wrote about using CSS to recognize links:

> In fact, I could start right here, and echo something that somebody
> showed me recently and that looks quite interesting:
> 
>  Name:       link1
>  Values:     <selector>? attr(<name>) | none
>  Initial:    none
>  Applies to: all elements
>  Inherited:  no
> 
>  Name:       link2
>  Values:     <selector>? attr(<name>) [ , <selector>? attr(<name>) 
]* | none
>  Initial:    none
>  Applies to: all elements
>  Inherited:  no
> 
> 'Link1' is the normal kind of hyperlink, the one you activate with 
the
> left mouse button. 'Link2' gives secondary hyperlinks, the ones for
> which you have to do something special, such as shift-click or right
> click.

I think a better mechanism would be as follows (though I am not yet 
convinced that CSS should involve itself in link recognition).

Name:       link
Values:     [ none | <selector>? attr(<name>) ]
                 [ , <selector>? attr(<name>) ]*
Initial:    none
Applies to: all elements
Inherited:  no

The solitary 'none' means that this style sheet does not find any link 
here, although link recognition by other means is still possible.  In 
all other cases, the first item in the list determines whether and 
what the primary link is.  Thus, there may be no primary link while 
one or more secondary links exist:

blockquote { link: none, attr(cite) }

> Styling primary links can still be done with the ':link' and
> ':visited' pseudo-classes, but with the extra restriction that the
> 'link1' property may not occur in a rule with such a pseudo-class.
> This avoids:
> 
>    xyz:link { link1: none }  /* !? */

Would it be better to allow but ignore link properties in rules whose 
selectors include link pseudo-classes?  This would affect what is 
considered a valid style sheet.  Does this make a difference in 
implementation?  

-- 
Etan Wexler

Received on Monday, 1 October 2001 23:25:52 UTC