I'm trying to make all the contents of my li clickable - a big box with image tag and p elements inside.
I know you can't just wrap the lot in an a tag because it's not meant to contain block-level elements like the p tag.
One solution I came up with was to position the li relative, and create an empty a tag with a position of absolute, 100% size. This works in Firefox, but not in IE - the only clickable area of IE is the particular elements wrapped in the <a>. So to make all the block elements also clickable I'd have to put separate a tags on each - too much code.
I found a solution from Jquery but I'd really like to do this with just CSS. Is there a way? Here is my existing code with the above "solution", for a reference. I haven't put on the extra IE a tags, btw.
HTML Code:<ul id="agent-box"> <li> <img src="images/agent1.jpg" width="133" height="180" /> <p><a href="#">Scott Smith</a></p> <p>Broker, Owner</p> </li> </ul>Also, any suggestions on what is the most accessible & cleanly-degradable way to do this?Code:ul#agent-box { list-style:none; margin:0; padding:0; } ul#agent-box li { position:relative; width:132px; border:1px solid #999; padding:6px; margin: 20px 20px 20px 0; float:left; height:248px; } ul#agent-box li:hover { background-color:#FFCC99; } ul#agent-box li a { position:absolute; height:100%; width:100%; left:0; top:0; }
Thank you!!








Bookmarks