Jump to content

CSS table: Highlight a row on rollover, or click, etc....


jb60606

Recommended Posts

does anyone know a row highlighting technique that will work with CSS tables. I need the rows highlighted on a mouse rollover, or atleast a mouse click event. Is this even possible?

 

An AJAX script i've obtained uses a CSS table to organize it's data via multiple "<DIV>" tags. I've since configured the script to retrieve data from a mySQL database and it has become increasingly difficult to distinguish one line of data from the next, even with static row coloring.

 

Thanks in advance.

 

 

 

Link to comment
Share on other sites

data should be in tables not div tags - see if you can remove the divs...

 

tr:hover { ... } is what you are after BUT this won't work in IE6 - for that you will need to use js and the onmouseover event handler in the tr tag to set different backgrounds etc.

Link to comment
Share on other sites

Thanks, I figured as much.

 

I've tried replacing the DIV tags with TR/TD tags, etc, though, with the way the Javascript outputs the data, it screwed up the formatting. It's a third party script that I paid for, so I may have to ask/pay them to write a custom script.

 

Thanks

Link to comment
Share on other sites

Try by creating a link class as follows (using whatever colors your site uses) in your css:

 

.row a:link, .row a:visited {display:block; background-color:#FFFFFF, color:#000000}

.row a:link, .row a:active{display:block; background-color:#000000, color:#FFFFFF}

 

Now, in your markup, for each row you want to have a hover effect give it a class and blank link:

 

<span class="row"><a href="#">your row data</a></span>

 

This should work if you have already properly listed your main link tags - a:link, a:visited, a:hover, a:active

 

Dave

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.