Is linking a <div> using javascript acceptable?
Posted
by
jhchawk
on Stack Overflow
See other posts from Stack Overflow
or by jhchawk
Published on 2011-02-15T23:16:05Z
Indexed on
2011/02/15
23:25 UTC
Read the original article
Hit count: 263
I want to link an entire <div>
, but CSS2 does not support adding an href to a div (or span for that matter). My solution is to use the onClick property to add a link. Is this acceptable for modern browsers?
Example code:
<div class="frommage_box" id="about_frommage" onclick="location.href='#';">
<div class="frommage_textbox" id="ft_1"><p>who is Hawk Design?</p></div>
My test page is at http://www.designbyhawk.com/pixel. Updated daily.
Thanks for the help.
© Stack Overflow or respective owner