I've got a div and I want the entire thing to be a link, but if I wrap the anchor tags around the div the link lasts for the entire line.
<a href=http://www.webdeveloper.com/forum/archive/index.php/"#">
<div class="someclass">
This is text inside the div
</div>
</a>
Anyone know how to combat this?You can't actually wrap 'a' tags around a div. You could make a div into a link with javascript though... <!-- m --><a class="postlink" href="http://bonrouge.com/test/jslink.htmBut">http://bonrouge.com/test/jslink.htmBut</a><!-- m --> using js to make a link is slightly bad form when 10% of users have js disabled.
I did not realize you could not wrap the 'a' tag around the div.Yes, you're right - it's bad form. Well done. I was just giving you an option because you can't do it with html alone.Thank you for that, it was something I considered briefly. But I want to code useability into the page too, so I had to drop it.
I'll have to think up something else now too...Can't you put the link tags inside the div tags?Yes, but that makes only the text a link. I wanted the entire area to be a link.
Right now I have the tags inside the div, and I'm going to set an onclick for the rest of it. That way it behaves well for people w/javascript, and for people without it still acts normally.
<a href=http://www.webdeveloper.com/forum/archive/index.php/"#">
<div class="someclass">
This is text inside the div
</div>
</a>
Anyone know how to combat this?You can't actually wrap 'a' tags around a div. You could make a div into a link with javascript though... <!-- m --><a class="postlink" href="http://bonrouge.com/test/jslink.htmBut">http://bonrouge.com/test/jslink.htmBut</a><!-- m --> using js to make a link is slightly bad form when 10% of users have js disabled.
I did not realize you could not wrap the 'a' tag around the div.Yes, you're right - it's bad form. Well done. I was just giving you an option because you can't do it with html alone.Thank you for that, it was something I considered briefly. But I want to code useability into the page too, so I had to drop it.
I'll have to think up something else now too...Can't you put the link tags inside the div tags?Yes, but that makes only the text a link. I wanted the entire area to be a link.
Right now I have the tags inside the div, and I'm going to set an onclick for the rest of it. That way it behaves well for people w/javascript, and for people without it still acts normally.