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
Share on other sites

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.

 

 

Link to comment
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;
}

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.