meyerweb.com

More Flexible Linking

The general situation here is: there are many instances where making element content link to other content via HTML requires clumsy structures, and others where it is basically impossible. One example of clumsiness is linking images, which requires wrapping an a element around an img element just to make the latter "clickable". One example of impossibility is linking an entire table row.

Some possible solutions:

Leave things as they are and stick with DOM events to recreate this ability
Add href, hreflang, media, ping, rel, target, and type to a number of elements in HTML5
Devise some other attribute, such as link, which has the same basic effect
Change a so that it can wrap around any arbitrary collection of elements
Devise some new element like hlink that can wrap around any arbitrary collection of elements

Case By Case

Beyond the general case, it is very helpful to look at individual elements that would benefit from being linkable and demonstrate the reasons why this capability would be helpful.

The Holdover

Just to make clear that there are strong reasons to keep the traditional linking element as a member of the firmament.

  1. a

    Existing attributes
    href hreflang media ping rel target type
    Rationale for element preservation

    Not every instance of a hyperlink will be centered on some non-a element. Having a generic hyperlink element is still just as valuable as the day the web was invented. Furthermore, there would be something of a backwards-compatibility issue if the element were dropped.

New Additions

The elements for which I felt able to justify calling for addition of linking ability. The general guiding principle is that any case where it would be reasonable to wrap an a element around an element, or have an a element be the sole child of an element, indicates strong potential for a valid use case.

In my examples I use the href attribute because it makes the most sense to me, but in all cases I considered foremost whether it made sense to have an element become linkable as orthogonal to the exact method of achieving that linkage. Collectively, these form an argument for allowing a more robust and flexible linking mechanism, regardless of its specific form. Note too that I am assuming that adding href also means adding hreflang, media, ping, rel, target, and type, for all the reasons those attributes are useful for the a element.

  1. abbr

    Existing attributes
    title
    Rationale for addition

    There are two primary situations where an abbreviation should be linked elsewhere: when linking to an organization whose name is an abbreviation; and when linking to a dfn-enclosed definition of the abbreviation elsewhere in the document.

    Note: if acronym is ever restored to HTML5, the same rationale and use cases given here would apply for that element. I'm not holding my breath.

    Example(s)
    <p>The <dfn id="whatwg"><abbr title="Web Hypertext Application
    Technology Working Group" href="http://whatwg.org/">WHATWG</abbr></dfn>
    is a loose unofficial collaboration of Web browser manufacturers and 
    interested parties who wish to develop new technologies designed to 
    allow authors to write and deploy Applications over the World Wide Web.</p>
    
    <p>The <abbr title="Web Hypertext Application Technology Working Group" 
    href="#whatwg">WHATWG</abbr> community does not have much representation 
    from Asia.</p>
    
  2. address

    Rationale for addition

    Linked author contact information is generally more useful than unlinked author contact information.

    Example(s)
    <address href="mailto:emeyer@example.com">Eric A. Meyer</address>
    <address href="http://meyerweb.com/eric/">Eric A. Meyer</address>
    <address href="http://mag.example.com/article/132/authors/">Ian Hickson, 
    David Baron, and the Dalai Lama</address>
    
  3. aside

    Rationale for addition

    In cases where an aside is a pullquote, it makes sense to link to the source of the quote that's been pulled. It may also be the case that an aside references an external resource and that linking the entire aside to that resource is a better user experience than linking a subset of the aside's text with an a element.

    Example(s)
    <aside href="http://guide.example.org/">Want to learn more?  Our Giving
    Guide has the answers you seek!</aside>
    
    <p>He later joined a large company, continuing on the same work.
    <q>I love my job. <span id="aside-03">People ask me what I 
    do for fun when I'm not at work. But I'm paid to do my hobby, 
    so I never know what to answer.</span> Some people wonder 
    what they would do if they didn't have to work... but I know what 
    I would do, because I was unemployed for a year, and I filled 
    that time doing exactly what I do now.</q></p>
    
    <aside href="#aside-03">
     <q> People ask me what I do for fun when I'm not at work. But I'm
     paid to do my hobby, so I never know what to answer. </q>
    </aside>
    
  4. blockquote

    Existing attributes
    cite
    Rationale for addition

    To create a link to the source of the quoted material. This alone could be handled by the cite attribute, but the problem is that all of the linking semantics offered by the a element's attributes are lost here. Thus, for example, it is impossible to indicate the media type of a podcast, or the base language of a quoted article.

    It is possible that both cite and href could be present with differing values. This would permit a citation of the whole work while linking to a section of the work, for example. In cases where a blockquote has differing values for cite and href, the href value should be used when the user activates the element.

    Example(s)
    <blockquote href="http://podcast.example.net/42" media="audio/x-mp3">
    <p>So I told him I wasn't interested unless he threw in a Coney Island hot dog.</p>
    </blockquote>
    
    <blockquote cite="http://www.whatwg.org/specs/web-apps/current-work/"
    href="http://www.whatwg.org/specs/web-apps/current-work/#the-blockquote">
    <p>The best way to represent a conversation is not with the cite and blockquote 
    elements, but with the dialog element.</p>
    </blockquote>
    
  5. cite

    Rationale for addition

    To create a link to the cited resource. With the various attributes, it becomes possible to indicate the media type of cited a podcast, or the base language of a cited article.

    Example(s)
    <p><cite href="http://www.whatwg.org/specs/web-apps/current-work/">HTML5</cite> is 
    a work in progress.</p>
    <p>I found <cite href="http://podcast.example.net/42" media="audio/x-mp3">Episode 42 
    of the "Frank 'n' Beans Hour"</cite> to be less amusing than previous entries.</p>
    
  6. code

    Rationale for addition

    A fragment of code may need to be linked to the program from which it has been excerpted, or to documentation on that bit of code.

    Example(s)
    <p>In WordPress, information about the blog installation can be retrieved using
    the <code href="http://codex.wordpress.org/Template_Tags/bloginfo">bloginfo()</code>
    function.</p>
    
  7. del

    Existing attributes
    cite datetime
    Rationale for addition

    Providing a link to more detailed reasoning about the deletion. This alone could be handled by the cite attribute, but the problem is that all of the linking semantics offered by the a element's attributes are lost.

    It is possible that both cite and href could be present with differing values. This would permit a citation of the whole work while linking to a section of the work, for example. In cases where a del has differing values for cite and href, the href value should be used when the user activates the element.

    Example(s)
    <del cite="http://blog.example.com/2008/06/04/sorry-hixie-i-was-on-drugs" 
    href="http://blog.example.com/2008/06/04/sorry-hixie-i-was-on-drugs#p5" 
    datetime="2008-06-04T23:45-04:00">I really hate cats.</del>
    
  8. dfn

    Existing attributes
    title
    Rationale for addition

    While there can be provision of an in-document definition, it is often useful to link to a more detailed or extended definition.

    Example(s)
    <p>The <dfn href="http://www.gateworld.net/omnipedia/technology/links/g.d.o..shtml">
    <abbr title="Garage Door Opener">GDO</abbr></dfn> is a device that allows 
    off-world teams to open the iris.</p>
    
  9. dialog

    Rationale for addition

    In cases where a fragment of a longer dialog is presented, it is useful to be able to link back to the original source dialog, so as to provide the context for the provided fragment.

    Note: it may be argued that this can be made unnecessary by wrapping the dialog element in a linked blockquote element.

    Example(s)
    <dialog href="http://meyerweb.com/eric/thoughts/2006/11/19/thats-pretty-old/">
    <dt>Carolyn</dt>
    <dd>Daddy, what old is Bear?</dd>
    <dt>Eric</dt>
    <dd>Do you mean how old is Bear?</dd>
    <dt>Carolyn</dt>
    <dd>How old is Bear, yes.</dd>
    <dt>Eric</dt>
    <dd>I don't know, sweetie. How old do you think he is?</dd>
    </dialog>
    
  10. div

    Rationale for addition

    There are times when a flow element is needed to contain a few bits of information that are all related, and could all benefit from being linked to an in-depth resource. Examples include error messages, portal boxes, and artistic gallery pages.

    Example(s)
    <div id="error_note" href="/error-list.html">
    <h3>Errors</h3>
    <p>No errors.</p>
    </div>
    
    <div class="photo" href="19823-detail.html">
    <img src="pix/19283.jpg" alt="" />
    19283. Lady in waiting.
    </div>
    
  11. figure

    Rationale for addition

    A figure may properly link to more information or an alternate view of the content(s) enclosed in the figure. Examples include high-resolution versions of displayed images, pages which provide more detailed information about the figure, and so on.

    Example(s)
    <figure href="bubbles-work-hires.jpg">
     <img src="bubbles-work.jpeg"
          alt="Bubbles, sitting in his office chair, works on his
               latest project intently.">
     <legend>Bubbles at work</legend>
    </figure>
    
    <figure href="castle-history.html">
     <img src="castle1423.jpeg" title="Etching. Anonymous, ca. 1423."
          alt="The castle has one tower, and a tall wall around it.">
     <img src="castle1858.jpeg" title="Oil-based paint on canvas. Maria Towle, 1858."
          alt="The castle now has two towers and two walls.">
     <img src="castle1999.jpeg" title="Film photograph. Peter Jankle, 1999."
          alt="The castle lies in ruins, the original tower all that remains in one piece.">
     <legend>The castle through the ages: 1423, 1858, and 1999 respectively.</legend>
    </figure>
    
    
  12. footer

    Rationale for addition

    While footers may contain multiple pieces of information, in many cases they will be used to provide "back to top" or "back to table of contents" functionality. It is also possible that a footer containing a quick notice of ownership would need to link to a more detailed page containing terms of use, privacy policies, and more.

    Example(s)
    <footer href="../">Back to index...</footer>
     <h1>Lorem ipsum</h1>
     <p>A dolor sit amet, consectetur adipisicing elit, sed do eiusmod
     tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim
     veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex
     ea commodo consequat. Duis aute irure dolor in reprehenderit in
     voluptate velit esse cillum dolore eu fugiat nulla
     pariatur. Excepteur sint occaecat cupidatat non proident, sunt in
     culpa qui officia deserunt mollit anim id est laborum.</p>
     <footer href="../">Back to index...</footer> 
    
  13. h1

    Rationale for addition

    Headings are sometimes linked to other resources. One example would be linking a site-identifying h1 to the home page of the site.

    Example(s)
    <h1 href="/index.html">ConHugeCo Inc.</h1>
    
  14. h2

    Rationale for addition

    Headings are sometimes linked to other resources. One example would be linking the chapter titles in a table of contents to the actual chapter documents.

    Example(s)
    <h1>Table of Contents</h1>
    <h2 href="ch1.html">Chapter 1. Introduction</h2>
    <h2 href="ch2.html">Chapter 2. Tea For Two</h2>
    <h2 href="ch3.html">Chapter 3. Thrice the Price</h2>
    <h2 href="ch4.html">Chapter 4. The Larch</h2>
    
  15. h3

    Rationale for addition

    Headings are sometimes linked to other resources. One example would be linking the section and subsection headings of a particularly long document back to the top of the page.

    Example(s)
    <h3 href="#top">Enjoying the sun</h3>
    
  16. h4

    Rationale for addition

    Headings are sometimes linked to other resources.

    Example(s)

    See the examples for h1, h2, and h3.

  17. h5

    Rationale for addition

    Headings are sometimes linked to other resources.

    Example(s)

    See the examples for h1, h2, and h3.

  18. h6

    Rationale for addition

    Headings are sometimes linked to other resources.

    Example(s)

    See the examples for h1, h2, and h3.

  19. img

    Existing attributes
    alt height ismap src usemap width
    Rationale for addition

    It is incredibly common to have an image link to some other resource—a higher-resolution version, a resource of another medium (such as an image of a speaker linking to an audio file), or another web page.

    Example(s)
    <img src="picture22.gif" href="picture22-hires.gif" alt="A picture of my face">
    <img src="audio.gif" alt="Audio file (822KB)" href="ringtone.mp3">
    <img href="page27.html" src="next.gif" alt="Next page">
    
  20. ins

    Existing attributes
    cite datetime
    Rationale for addition

    Providing a link to more detailed reasoning about the insertion. This alone could be handled by the cite attribute, but the problem is that all of the linking semantics offered by the a element's attributes are lost.

    It is possible that both cite and href could be present with differing values. This would permit a citation of the whole work while linking to a section of the work, for example. In cases where a ins has differing values for cite and href, the href value should be used when the user activates the element.

    Example(s)
    <ins cite="http://blog.example.com/2008/06/04/sorry-hixie-i-was-on-drugs" 
    href="http://blog.example.com/2008/06/04/sorry-hixie-i-was-on-drugs#p8" 
    datetime="2008-06-04T23:45-04:00">I just lurrrve cats, especially little kitties.</ins>
    
  21. kbd

    Rationale for addition

    There are circumstances in which a bit of keyboard input needs to be linked to explanatory information. This would be especially useful in "help" systems and tutorials for newcomers to a program (or computing in general).

    Example(s)
    If you want to access the console press 
    <kbd href="where-is-the-tilde-key.htm">Tilde</kbd>
    
  22. legend

    Rationale for addition

    There are circumstances in which the legend of a figure, fieldset, or other containing object should link to more information or a related resource.

    Example(s)
    <fieldset>
     <legend href="/help/personalinfo.html">Personal information</legend>
     ...
    </fieldset>
    
    <figure>
     <object type="application/x-java-applet">
      <param name="code" value="MyJavaClass">
      <p>You do not have Java available, or it is disabled.</p>
     </object>
     <legend href="/proj/java/clock.html">My Java Clock</legend>
    </figure>
    
  23. li

    Existing attributes
    value
    Rationale for addition

    In many cases, most obviously the use of a list to contain a set of navigation links, list items are entirely filled by hyperlinks and no other content. Although the a elements may sometimes be useful for styling purposes, they are superfluous structural elements and could in some cases be replaced by linked list items.

    Example(s)
    <nav>
      <h1>Navigation</h1>
      <ul>
       <li href="articles.html">Index of all articles<li>
       <li href="today.html">Things sheeple need to wake up for today<li>
       <li href="successes.html">Sheeple we have managed to wake<li>
      </ul>
    </nav>
    
  24. mark

    Rationale for addition

    Content which has been highlighted using mark may be served by creating a link to some resource which explains in more detail the reason for the highlighting. It also provides a method by which highlighting marks can refer to other parts of the same document.

    Example(s)
    <p><mark href="#notes">An obstruction in a gate will prevent it from 
    accepting a wormhole connection.</mark></p>
    
  25. meter

    Existing attributes
    high low max min optimum value
    Rationale for addition

    Meters will often benefit from being linked to resources which explain how the metered levels are determined, or to give more detailed information about the specific metering level being displayed.

    Example(s)
    <p><meter value="0.25" href="/ranking.html#low">Low activity,</meter> Usenet, 
    66 subscribers</p>
    
    <meter href="/how-we-measure.html" min=0 max=20 
     value=12 title="centimeters">12cm</meter>
    
  26. progress

    Existing attributes
    max value
    Rationale for addition

    In a fashion similar to meter, progress indicators will in some cases need to be linked to more details about the thing whose progress is being tracked. This would be especially helpful in cases where there are multiple progress indicators on a single page, such as a download tracker.

    Example(s)
    <progress href="details?thing=7">21%</progress>
    
  27. q

    Existing attributes
    cite
    Rationale for addition

    To create a link to the source of the quoted material. This alone could be handled by the cite attribute, but the problem is that all of the linking semantics offered by the a element's attributes are lost here. Thus, for example, it is impossible to indicate the media type of a podcast, or the base language of a quoted article.

    It is possible that both cite and href could be present with differing values. This would permit a citation of the whole work while linking to a section of the work, for example. In cases where a q has differing values for cite and href, the href value should be used when the user activates the element.

    Example(s)
    <p>As Tim Berners-Lee said, <q href="http://example.com/quotes/tbl33.html">
    "That idea of URL was the basic clue to the universality of the Web.  That 
    was the only thing I insisted upon."</q></p>
    
    <p>His best argument: <q href="http://lists.example.org/Archives/2008/Mar/71193#p22" 
    cite="http://lists.example.org/Archives/2008/Mar/71193">I disagree!</q></p>
    
  28. samp

    Rationale for addition

    Samples of output are often not enough to provide a full working knowledge of their causes and resolution. Linking to more information is often desirable in these circumstances.

    Example(s)
    The program responded with <samp href="manual-error500.html">Error 500: 
    Program had an error!</samp>, so I reverted the config file.
    
  29. sub

    Rationale for addition

    Subscript elements often represent terms or concepts which may be unfamiliar to the reader; for example, in formulas. They can also be used to denote numeric systems which would benefit from being linked to more detailed explanations.

    Example(s)
    V = V<sub href="transverse.html">T</sub> - V<sub href="radial.html">r</sub>
    
    100<sub href="binary.html">bin</sub> = 4<sub href="decimal.html">dec</sub></pre>
    
  30. sup

    Rationale for addition

    Superscript elements are used to create footnote references, and those references are usually linked to the actual footnotes (with corresponding superscripted numbers in the footnotes that link back to the referencing text). Rather than having a sup wrapping an a element, it would make more sense to link the superscript itself.

    Example(s)
    <p>It has been shown that the decline in pirates is directly correlated 
    to the rise in global temperatures.<sup href="#footnote-003">[3]</sup></p>
    
  31. td

    Existing attributes
    colspan rowspan
    Rationale for addition

    In tables of data, each cell is often a small fragment of content summarizes more in-depth data. For example, a cell might contain a total dollar amount for a certain product or period of time (or both), or test results, or any number of other things. The ability to click on that cell and get a detailed breakdown of the figures that went into the presented content is highly valuable.

    Example(s)
    <td href="sales?product=a44">$27,924</td>
    
    <td href="benchmark?ua=ff&t=7">244ms</td>
    
  32. th

    Existing attributes
    colspan rowspan scope
    Rationale for addition

    Table headers can be cryptic in the interests of having small amounts of content. Being able to link from those cells directly to a legend (or key) explaining what they mean improves the usefulness of the table.

    Example(s)
    <th href="legend.html#PHA">PHA</th>
    <th href="legend.html#O2V%">O2V %</th>
    
  33. time

    Existing attributes
    datetime
    Rationale for addition

    There are two use cases here. The first is where time-based information may need to link to more detailed information; for example, the times in a public transportation schedule linking to more information about that route, station, or bit of the schedule. The other, which is already widespread, is the use of posting times as "permalinks" for both blog posts and comments on them.

    Example(s)
    <time datetime="2008-06-05T16:50:37-00:00" 
    href="http://meyerweb.com/eric/thoughts/2008/06/05/strengthening-links/">Thu 5 Jun 2008 1250</time>
    
  34. tr

    Rationale for addition

    In tables of data, each row is often a grouping of information that summarizes more in-depth data. For example, a row of numbers showing income and expense totals for one month of the year could link to a detailed breakdown of that month's activity. The ability to click on the row to get to that information is highly valuable.

    Example(s)
    <tr href="show_flow.php?month=200805">
    ...
    </tr>
    
    <tr href="sales?state=OH&product=722">
    ...
    </tr>
    
  35. var

    Rationale for addition

    A variable may be defined (in the sense of its role in a program being explained) away from mention of the variable, so linking to the definition assists in recall and learning. Less commonly, there may be a need to link to related material which explains the use of variables in general.

    Example(s)
    <p>Here we pass the variable <var href="#var-loop">loop</var> 
    to the function.</p>
    
    <p>If there are <var href="what-is-n.html">n</var> pipes leading 
    to the ice cream factory then I expect at <em>least</em> 
    <var>n</var> flavours of ice cream to be available for purchase!</p>
    
  36. video

    Rationale for addition

    It is a widespread convention that embedded video leads back to a main page or other resource describing more about the video (see, for example, any embedded YouTube or Vimeo video).

    Example(s)
    <video src="bigdog.mov" href="http://bostondynamics.com/content/sec.php?section=BigDog"
     autoplay controls>
    

Possible Additions

These are the elements that seemed to be good candidates on the first pass, but upon further reflection failed to present obvious use cases. I'm open to suggestions.

  1. article

    Rationale for addition

    I'm not sure there's any reasonable case for linking an entire article.

    Example(s)
    ???
    
  2. caption

    Rationale for addition

    I had thought that a caption could link to more information about the table in question, but that seemed better handled by linking the actual table itself.

    Example(s)
    ???
    
  3. dd

    Rationale for addition

    Sort of by definition (ah ha ha), the contents of this element should provide whatever information is needed—in other words, there shouldn't be a need to link to more detailed information.

    Example(s)
    ???
    
  4. details

    Existing attributes
    open
    Rationale for addition

    I'm not even 100% sure I get what this element is meant to do, so it was hard to find a use case for linking it.

    Example(s)
    ???
    
  5. dt

    Rationale for addition

    The only thing this would seem to need to link to is the associated dd, which is right there in the markup (as in adjacent) so attribute-based linking doesn't seem to make much sense. On the other hand, should this be added as a machinie-parseable way of associating a definition with the term? Or do we rely on the structural adjacency for that?

    Example(s)
    ???
    
  6. header

    Rationale for addition

    There was a fairly straightforward use case for footer, but this didn't have the same ease of casing.

    Example(s)
    ???
    
  7. p

    Rationale for addition

    A whole paragraph as a link... hmmm. This didn't seem too likely a scenario.

    Example(s)
    ???
    
  8. pre

    Rationale for addition

    Like p, it was hard to think of a reason to need to link an entire pre.

    Example(s)
    ???
    
  9. span

    Rationale for addition

    It really seemed like if you needed a generic inline element to create a hyperlink, you'd use a, not span.

    Example(s)
    ???
    
  10. table

    Rationale for addition

    Do the rationales presented for tr, th, and td make sense when applied to the whole table? Are there other rationales for full-table linking?

    Example(s)
    ???
    
  11. tbody

    Rationale for addition

    Though it seemed obvious that one would extrapolate from cell linking to row linking to table-sectional linking, no specific use cases came to mind when actually faced with tbody. If it's possible to have multiple tbody elements in the same table, then use cases are much easier to imagine, but the specification doesn't make clear whether or not this is the case. If multiples are not allowed, then is there any reason to make this element linkable? (The same questions and thinking hold for tfoot and thead.)

    Example(s)
    ???
    
  12. tfoot

    Rationale for addition

    See tbody.

    Example(s)
    ???
    
  13. thead

    Rationale for addition

    See tbody.

    Example(s)
    ???
    

(Possibly) Unsuitable Elements

These are the elements that did not seem to have use cases when I first went through the list. They are included here to round out the list of HTML5 elements, and also as a resource for reconsidering whether any of them would benefit from being linkable.

  1. audio
  2. b
  3. bdo
  4. body
  5. br
  6. canvas
  7. col
  8. colgroup
  9. command
  10. datagrid
  11. datatemplate
  12. dl
  13. em
  14. embed
  15. event-source
  16. hr
  17. html
  18. i
  19. iframe
  20. mark
  21. map
  22. menu
  23. meta
  24. nav
  25. nest
  26. noscript
  27. object
  28. ol
  29. param
  30. rule
  31. script
  32. section
  33. small
  34. source
  35. strong
  36. style
  37. title
  38. ul

Elements That Already Link

Those elements that already provide some form of linking via the href attribute, and so don't need extra linkability. Two—a and area—also have the attributes hreflang, media, ping, rel, target, and type.

  1. a
  2. area
  3. base
  4. link