XHTML validating block level element as a link

Posted by Matty F on Stack Overflow See other posts from Stack Overflow or by Matty F
Published on 2010-03-16T17:13:27Z Indexed on 2010/03/16 17:21 UTC
Read the original article Hit count: 341

Filed under:
|
|
|

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?

© Stack Overflow or respective owner

Related posts about XHTML

Related posts about anchor