Jump to content

whole div as hyperlink not working


MDanz

Recommended Posts

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>";

Link to comment
https://forums.phpfreaks.com/topic/194502-whole-div-as-hyperlink-not-working/
Share on other sites

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  :confused:

 

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;
}

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.