Wrapping a div in an anchor tag
- Started
- Last post
- 10 Responses
- bort0
Cool. I'll give it a shot.
- bort0
The proper cursor now appears but IE still won't recognize the thumbnail region of the link. If I hover over the <h2> area, the link works. The <img> area, the link address appears in the browser window, but it won't actually work.
- foobaz0
You can try an onclick handler in the div itself...it won't work if javascript is turned off...but as long as you have the anchor tag wrapped around the image pointing to the same location that is a good fallback.
- lukus_W0
bort - what css are you using with this?
- lukus_W0
post a link to your page and I'll help
- lukus_W0
Change your markup to...
<div class="homeThumb">
<a class="roll" href="">
<img src="images/thumb_3.jpg" width="182" height="110" alt="thumb" />
</a>
<h2>Title goes here</h2>
</div>Then using CSS
1. set 'position: relative' on the containing div
2. make your anchor 'position: absolute', display it as a block-level element and make it equal width / height as the div.
3. set the z-indexes to place the anchor element below the h2 and img elements