Jump to content



Welcome to KnowledgeSutra - Dear Guest , Please Register here to get Your own website. - Ask a Question / Express Opinion / Reply w/o Sign-Up!
- - - - -

Onmouseover In <td> How To


2 replies to this topic

#1 contactskn

    Privileged Member

  • Kontributors
  • PipPipPipPipPipPipPipPipPip
  • 756 posts

Posted 29 November 2009 - 09:21 AM

Dear friends I want to change the background color of a cell on mouse over it. So I would like to know what is the code for the same I mean to say as soon as I take the mouse pointer on the cell its background color should be changed and as soon as the mouse pointer is again moved back then it should be the same as previous.

#2 Baniboy

    Advocatus Diaboli

  • Kontributors
  • PipPipPipPipPipPipPipPipPip
  • 878 posts
  • Gender:Male
  • Location:/root
  • Interests:Everything...
  • myCENT:37.47

Posted 29 November 2009 - 10:42 AM

You use this in a css file:
CSS

td {
	 background: white;
	 color: black;
}

td:hover, td:active, td:focus {
	 background: black;
	 color: white;
}

:hover, :focus and :active ensure compatibility with most browsers. But please, please don't use tables, they are horrible.

Edited by Baniboy, 29 November 2009 - 10:43 AM.


#3 shadowx

    Live your life so that in death you may stand side by side with your gods. Not at their feet.

  • Kontributors
  • PipPipPipPipPipPipPipPipPipPipPipPipPipPip
  • 1,674 posts
  • Gender:Male
  • Location:Essex, UK
  • Interests:Photography is a big interest, i have some photos up at my site, apex photographs (http://apex-photographs.com). Using my Lumix g1 to take the photos of course! <br /><br />Um computer games... photo editing and thats about it!
  • myCENT:68.57
  • Spam Patrol

Posted 30 November 2009 - 09:11 AM

:hover should do the trick. Tables have their place but i dropped them long ago for general layout. They are only good now for their intended purpose. Displaying data in a table, not for arranging links etc...




Reply to this topic


This post will need approval from a moderator before this post is shown.

  


1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users