Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
The moose likes HTML, CSS and JavaScript and the fly likes Mouse hover on TD Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Mouse hover on TD " Watch "Mouse hover on TD " New topic

Mouse hover on TD

Mahendran Aiyappan
Ranch Hand

Joined: Sep 05, 2005
Posts: 102
Hi guys,

How to use the class:hover CSS into TD tag so that when the mouse is over the column i want to display a border on it.

I know that a:hover can be used for href tag.

I want the same thing to TD tag.

Please give me a solution.


Mahendran A
Subhadip Chatterjee
Ranch Hand

Joined: Dec 12, 2006
Posts: 93
Can you not write a script function, onmouseover of the TD, to show the border color? If possible, you can put that into your stylesheet, so, that it will affect all the TDs, throughout your app <if that's what you want, to be consistent>.

Refreshing life every moment...
Mahendran Aiyappan
Ranch Hand

Joined: Sep 05, 2005
Posts: 102
Hi Subhadip,
Thanks for your reply

I know i can write a Javscript function which will be called by onMouseOver() and onMouseOut() functions to change the border color of TD.

But i want to do the thing in CSS way.

Just like a:hover{ }

can you suggest me any good links or code snippets

Mahendran A
Eric Pascarello

Joined: Nov 08, 2001
Posts: 15385
Talked about it on my blog here:


There is a way to add properties with a .hta file, but I do not think that is the best solution.

I agree. Here's the link:
subject: Mouse hover on TD
It's not a secret anymore!