Previous Message
Next Message

Selecting for External Links (was: Re: [css-d] Re: This site

Sent by Porter Glendinning on 1 February 2002 15:03


At 13:59 2/1/02, Timothy J. Luoma digitized these thoughts:
>Now the only problem with this is that I have to remember to add
>'class="offsite"' for all such links.
>
>Is there an easier way?  (All the links to my domain itself are relative,
>using foo/bar or /foo/bar etc... that is, there is no http://)

With what's currently available I don't believe there's a pure-CSS way 
to do it without a class (or similar approach); however, the candidate 
recommendation for CSS3 selectors [1] suggests that we may soon have 
the ability:

     a[href^="http://"]::after {
         content: "[" attr(href) "]";
     }

The selector in the above example would match any a element whose href 
attribute begins exactly with the string "http://".

- Porter

[1] http://www.w3.org/TR/css3-selectors/

+--------------------------------------------------------+
| Porter Glendinning      [EMAIL-REMOVED]  |
| Web/UI Commando            http://www.glendinning.org  |
+--------------------------------------------------------+
| Porter's Workshop - http://www.serve.com/apg/workshop/ |
+--------------------------------------------------------+
Previous Message
Next Message

Message thread: