Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Change cell background color when clicking on hyperlink.

Status
Not open for further replies.

bigdavidt

Programmer
Feb 12, 2004
52
US
Good evening. I am reworking a web site for a client. I have set things up in my CSS file so that a hyperlink changes color when a cursor is above the text on one of my web pages, and again once a page has been visited. What I would like to do is to have a similar color change for the cells that contain the hyperlink text. I am not sure of what syntax to use. Can someone give me a few ideas?

Thank you in advance.
 
1. You could expand the anchor (<a>) element to fit it across the entire cell. You would do that by changing its display to block and add width and height. Then you could simply use :hover for cursor above and :visited for visited.

2. You could use javascript events onmouseover and onmouseout to do the same. You could also do this via one of the javascript frameworks.

However, I wonder if you need a table anyway -- is this tabular data we're talking about?

Do something about world cancer today: Comprehensive cancer control information at PACT
 
Given IE 6 doesn't handle :hover on anything other than anchors (or children thereof), why not make the anchors block-level, taking up the full width/height of the cell. That way, no JS will be needed.

Hope this helps,
Dan



Coedit Limited - Delivering standards compliant, accessible web solutions

Dan's Page [blue]@[/blue] Code Couch:
Code Couch Tech Snippets & Info:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top