making a Cell as a link

liunx

Guest
hello<br />
<br />
i'm trying to make my whole cell (cell in a table) as link.. but the problem comes when the mouse moves over it, mouse's style doesn't change into a "hand" style.. <br />
this is what i tried:<br />
<br />
<br />
<br />
<table><br />
<tr><br />
<a href=http://www.webdeveloper.com/forum/archive/index.php/"myPage.html"> <td align="left" background="blue"> About Us </td> </a><br />
</tr><br />
<br />
<br />
<br />
i'm wandering if anyone has the solution<br />
my best regards.<!--content-->In the cell not around it:<br />
<td align="left" background="blue"><a href=http://www.webdeveloper.com/forum/archive/index.php/"myPage.html"> About Us </a></td><!--content-->a block level element (a table cell for example) cannot be nested within an inline element (<a>, <span>, etc). You can make your link like this.<br />
<a href=http://www.webdeveloper.com/forum/archive/index.php/"yoursite" style="height:10px; width:50px; display:block;">this link will appear like a box, like a table cell, it can also act like a hover link</a><br />
<br />
Just put those in a <div> or a cell, and use a <br> to drop them to the next line. Or put them in a list. <br> will work for this since it is essentially a line break, but if you want to be really right on target, you could put them all in the same class and give them a top margin and such so that they fall into place without a line break. What I have been talking about, and what is in that style attribute above is all css. You could make the table cell act as a link when it is clicked using a js event handler, but you should still put a link inside of the cell if you do this, otherwise 13% of your users will not be able to navigate your site, that number is according to last year's stats on <!-- w --><a class="postlink" href="http://www.thecounter.com">www.thecounter.com</a><!-- w --><!--content-->Now, although I doscourage the use of tables for non-tabular data like most people here, I don't even know what your using this for, so I'll give you another angle at making a whole cell work as a link. Make the table as usual, maybe even making the cell in question with fixed width or whatever, but when it comes to the link that needs to take up the entire cell, give it a class (i.e.: <a href=http://www.webdeveloper.com/forum/archive/index.php/"#" class="cellLink">This link'll take up the whole cell</a>).<br />
<br />
Then, in your CSS style rules place <br />
a.cellLink {<br />
width: 100%;<br />
height: 100%;<br />
display: block;<br />
...<br />
}<br />
a.cellLink:hover {<br />
hover effects<br />
...<br />
} Now, since the link is stretched to take up the entire cell (which is its parent), if your mouse is anywhere in the cell, it should act the same as if your mouse was over the link.<br />
<br />
I think, anyways. :p<br />
<br />
EDIT: Just remembered you have to display the link on a block level.<!--content-->
 
Back
Top