Div link

Heya. What’s a xhtml strict way of linking a whole div ? It’s got no content apart from a background image.

thanks :beer2:

I think using the onclick event of the div to change the location.href of your current page is the only way to do this. I have been known to be wrong though. :slight_smile:

^hes right. The basic way is to do whats below. If you want to do a better way put a style=“display:block;width:100%;heigh:100%;” and positon the href over the div (usually by placing it into another div).

The simple JS way is below (off the top of my head and its late):

<div class="ClassRollout" onclick="location.href='http://www.google.com/'" onmouseover="this.className='ClassRollover'" onmouseout="this.className='ClassRollout'">
content
</div>

//might be window.location.href if above doesn’t work

Thanks ; )

worked great btw, just had to set cursor:pointer to indicate the link (header in my blog)

thanks guys!

glad to help :slight_smile: :thumb2: