MDanz Posted March 8, 2010 Share Posted March 8, 2010 I've got a 101px x 101px div with a background image and words of text. I've attempted to make the whole div a hyperlink but it only made just the text a hyperlink. if you check my website http://www.stackway.com/stack.php , when you click the word then the correct hyperlink comes up in the pop up div. If you click anywhere that isn't the word, the wrong hyperlink comes. please help!! .rollb a { display: block; width: 101px; height: 101px; background: url("http://www.stackway.com/stacktopic.jpg"); } echo (!empty($search)) ?"":"<td valign=\"middle\"><div class='rollb' align='center' ><a style='text-decoration: none' onmouseover='ChgText($number);ChgTo($number4); ' href='javascript:ShowContent(\"layer1\")' id='point' onclick='ShowContent(\"layer1\");'> <br /> <font size='1px' face='Arial' color='#FFFFFF'><b>$newname2</b></font><br /><font color='#E9A014' size='1px' face='Arial'>$num_rows <br />Reply</font> </a></div> </td>"; Quote Link to comment https://forums.phpfreaks.com/topic/194502-whole-div-as-hyperlink-not-working/ Share on other sites More sharing options...
ferdi Posted March 8, 2010 Share Posted March 8, 2010 I'd suggest you use Javascrpipt. The onclick event would do the trick for this. <div onclick="document.location='page.html'"> <!-- .... --> </div> Very messy though, would rather use a proper method, but you get the idea. Quote Link to comment https://forums.phpfreaks.com/topic/194502-whole-div-as-hyperlink-not-working/#findComment-1023015 Share on other sites More sharing options...
haku Posted March 9, 2010 Share Posted March 9, 2010 if you check my website http://www.stackway.com/stack.php , when you click the word then the correct hyperlink comes up in the pop up div. If you click anywhere that isn't the word, the wrong hyperlink comes. please help!! What Anyways, to make a whole div a link, you can do this: <div class="link_div"> <p>This is some text</p> <p>This is some more text</p> <p>And this is even more text</p> <a class="div_link" href="http://www.google.com/"> </a> </div>[/code> CSS: [code].link_div { height:50px; width:50px; } .div_link { height:100%; width:100%; display:block; } Quote Link to comment https://forums.phpfreaks.com/topic/194502-whole-div-as-hyperlink-not-working/#findComment-1023319 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.