views:

53

answers:

1

I need a way to make an entire DL element clickable with only one anchor tag, that validates as XHTML. As in:

<a>
    <dl>
        <dt>Data term</dt>
        <dd>Data definition</dd>
    </dl>
</a>

This currently doesn't validate as XHTML as the anchor tag cannot contain the DL. The only way I can get it to validate is if I make two anchor tags and place them inside DT and DD. As in:

<dl>
    <dt><a>Data term</a></dt>
    <dd><a>Data definition</a></dt>
</dl>

I'm trying to avoid this, as it would result in two href attributes requiring maintenance, introducing the possibility they could become out of sync.

Suggestions?

A: 

You cannot do this and still validate. You will have to make a choice:

  1. Use non-valid markup
  2. Use inner anchors
  3. Use JavaScript

I recommend #2 as it is valid and will work for clients without JS.

Dustin Laine