QRe: [thelist] Question about proper tag

rudy rudy937 at rogers.com
Sun Aug 24 22:05:26 CDT 2003


> I have a question about the proper "semantic" tag if you want something
> to serve as both a heading and an anchor. Do you nest <h*> tags and <a>
> tags? What's the best way to do it?

that's a great question

> An example would be if I made something like a site map. Main sections
> would be headings, but would also link to the index page of the section.
> Below each section would be lists of links.

that example is easy

  <h2><a href="section/index.html">Section</a></h2>

this is not a problem because the link is clearly a link, yet its place in
the site map clearly indecates it's a heading

trickier is if an H is also an anchor, i.e. part way down the page you have

  <h2><a name="section">Section</a></h2>

and, say, a table of contents at the top of the page links to it

this has always given folks fits, because of the style that the A gives the
heading -- it looks like a link but isn't

to get around it many people do this --

  <a href="section"></a><h2>Section</h2>

but i think the nested A is semantically better

just style A completely differently than A:LINK


rudy




More information about the thelist mailing list