homepage Welcome to WebmasterWorld Guest from 54.237.213.31
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Code, Content, and Presentation / HTML
Forum Library, Charter, Moderators: incrediBILL

HTML Forum

    
adding a link to a <td>?
Sarah Atkinson

10+ Year Member



 
Msg#: 3816516 posted 9:55 pm on Dec 30, 2008 (gmt 0)

I'm working on a site that is 90% tabular data. I never thought I would code this many tables in my life once I switched over to CSS for layout. I want to make a table cell clickable so that a person can drill the data from that cell down further. I'm displaying the data in the cell by color ad not text with each color representing a different possible variable for that cell. The color is being displayed by changing the background color of each cell using css. So there is very little text in the cell to make clickable. Is there an easy way to make the whole thing clickable?

 

tedster

WebmasterWorld Senior Member tedster us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 3816516 posted 11:18 pm on Dec 30, 2008 (gmt 0)

I've seen a feww approaches, and there may be others. The choice depends on whether you need a true <a> element or not.

If you do want to use an <a> tag, then play around with padding on the anchor tag for that little bit of text that you do have. The padding area is completely clickable, so this can expand the "hotspot" to fill (or nearly fill) the table cell.

Also, try giving the <a> tags a display:block rule. This way you can define a width and height for the anchor tag that fills (or nearly fills) the entire cell

A different approach uses javascript on the <td> element, giving it an onclick action - onmouseover as well, if you want to simulate a hover behavior. The plus side here is that the entire cell becomes clickable, no little "dead zones" around the edges. The downsite is that you are using javascript (may be turned off) and search engines will not see these clickable cells as ture links.

Sarah Atkinson

10+ Year Member



 
Msg#: 3816516 posted 1:10 pm on Dec 31, 2008 (gmt 0)

Well this site will be a none searchable private site so search engines are not a concern. I have a feeling javascript is going to be the way to go but I was hoping there was a better way.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / HTML
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved