W3C home > Mailing lists > Public > www-validator@w3.org > July 2004

Re: [VE][65] Error Message Feedback

From: Jukka K. Korpela <jkorpela@cs.tut.fi>
Date: Fri, 9 Jul 2004 11:32:58 +0300 (EEST)
To: www-validator@w3.org
Message-ID: <Pine.GSO.4.58.0407091122470.10626@korppi.cs.tut.fi>

On Fri, 9 Jul 2004, Björn Hagström wrote:

> The problem is that I want the <a> to go beyond the <h1> and it would look like this:
> <h1><a>Heading</h1>
> The actual text</a>
> and I don't think that is allowed either is it?

It isn't, of course. It would not even be well-formed, to use the XML
jargon - and, contrary to cargo cult supported even by some misleading
statements from the W3C, it wasn't ever allowed by any HTML
specification either. The HTML 2.0 specification allowed nesting
<h1> inside <a> (but recommended nesting them the other way around),
but it did not allow tag soup like <h1><a>...</h1></a> - it could not,
since SGML does not permit it.

> And I don't want to use two <a> because it will confuse people with
> screenreaders navigating tabbing between links.

A good point.

But there is no way in HTML, as currently defined, to make a heading and
some subsequent text to act as one link, i.e. to put them inside an
<a> element. If you just want to set up a destination anchor, using
<a name="...">...</a> (optionally with an id="..." attribute too,
but without href="..."), then there's probably no point in trying to make
it span both the heading and the subsequent text, since it will
effectively be treated as referring to a point (the start of the element,
or the <a name="..."> tag so to say) rather than an area, a part of a
document. But if you wish to make the heading and the text "clickable",
pointing to some destination, then there's no way in standard HTML. (You
could simulate such behavior using JavaScript, or you might use the
invalid syntax and hope that browsers do what you want.)

Normally link texts should be short (remember that they could be used e.g.
for automatic construction of a list of all links on a page, or read in a
voice different from normal text, or underlined no matter you have said as
the author), so I'd just use <h1><a href="...">...</a></h1> if I wanted
(for some odd reason) to make the heading a link.

Jukka "Yucca" Korpela, http://www.cs.tut.fi/~jkorpela/
Received on Friday, 9 July 2004 04:33:00 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 15:30:45 UTC