Anne van Kesteren

Hyperlinks

Hyperlinks are the most important inventions on for the World Wide Web. Without them, navigation would be impossible. In basic HTML the only elements which are capable of linking documents with each other are a & link. An a element only links to another document if the attribute href is specified. If not it could still be useful by carrying an unique id. For example:

<a id="top">Top of the document!</a>

Though this is completely legal, I think it should be deprecated. Since the id attribute is allowed on almost every element (I think it may on the html element as well, but the validator says it's incorrect) it's stupid to do something like this:

<a id="new"></a>
<h2>NEW</h2>

<!-- better solution: -->

<h2 id="new">NEW</h2>

An important attribute is to my opinion the hreflang attribute. It tells the UA, which language is used in the source document. You could tell the user of your site which language is used with CSS (example uses CSS3 selectors):

selector{
 content:" attr(hreflang) ";
}

I don't use the above rule at the moment, but I should actually. It makes it a lot easier for users. I should use the rule too:

a[rel="external"]::after{
 content:" [ext] "; /* or url(), or a special entity */
}

By e-mail I got mailed an other example, which is probably better for sites that haven't used the rel attribute on a elements. The mail came from Kristiaan, who works at Cinnamon Interactive (Netherlands most advanced business site). You should now this example is invalid, but most of mine examples are invalid if you check them with the validator so it shouldn't be a problem:

a[href^="http://"]:not([href^="http://annevankesteren.nl/"]):after{  
 content:" [ext] ";
}

Related: In XHTML2 the attribute hreflang still existed in drafts, but in the last draft I can't find it anywhere. You would expect to find it here: Hypertext Attribute Collection, but it isn't there anymore. I searched the W3C mailing lists already and I found one e-mail about it from someone, who has the same problems as I have, when it's removed:

(note that you would have to use the following code to link the translation in the body of the text: <a href="foo.html.fr" xml:lang="fr">the French Translation of this document</a>, which is obviously wrong).

And I totally support that. It is wrong and it should be changed, anyone got ideas?

Comments

  1. You have my vote for hreflang which I heavily use on my site.
    Bring it back!

    Posted by Minz Meyer at