Ryan Freebern (rfreebern) wrote,
Ryan Freebern

  • Mood:

Valid XHTML 1.0

Want to make an entire <div> into a link and still have your XHTML 1.0 document validate? Try this:
<a href="http://corknut.org"><ins><div> div contents go here </div></ins></a>

Because while <div> isn't allowed inside <a>, it is allowed inside <ins>, which in turn is allowed inside <a>. And it validates! How ridiculous.

Then make sure the div's style uses cursor: hand; so that it looks like a link to the visitor.

(Thanks to okb for figuring this out for me.)

Edit: Okay, better solution: <span> is allowed inside an <a>, and with the display: block; style it works the same as a <div>. So that's what I ended up using.
  • Post a new comment


    Comments allowed for friends only

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded