Page 1 of 1

What is the best method to embed a link within a link

Posted: Fri Nov 17, 2006 4:14 pm
by intergroove
I'm generating a search results list where the client wants the whole row to highlight on hover and be clickable as well as have a 'buy now' link in the same row - ie embed a link within a link.

Here is one method I've tried:

Code: Select all

<a href='#'  class='example'>
	<div id="pic"><img src='../pic01.jpg'></div>
	<div id="rseltitle">Test Title</div>
	<div id="rselbox36">&pound;3.99</div>
	<div id="rselbox46"><a href="#">Test Link</a></div>
  </a>
Another:

Code: Select all

<a href='#'  class='example'>
            <table><tr>
                <td><img src='../pic02.jpg'></td>
	<td>Test Title2</td>
	<td>&pound;4.99</td>
	<td><a href="#">Test Link</a></td>
            </tr></table>
  </a>
The example class contains the hover code, etc.

I'm only getting partial success.

Is there a better/different way?

Thx in advance.

Posted: Fri Nov 17, 2006 4:32 pm
by nickvd
You can't embed links within other links (afaik). why not use the css :hover selector to cause the div to be highlighted (with the appropriate fix for IE6)

Posted: Fri Nov 17, 2006 5:00 pm
by Ambush Commander
Use regular links, but set display:block as their CSS.