Jump to content

column highlights with css


freelance84

Recommended Posts

.added_names_row{
background-color: #FFFFFF;	
}
.added_names_row:hover{
background-color: #CCFFF4;
}

 

When the above is applied to a <tr> tag, the background of the said row when you hover over with your mouse changes colour.

 

Is it possible to do the same with a column with just css?

 

ie... i want the user to be able to see their column title and row highlighted when hovering over a certain point

Link to comment
Share on other sites

I've just applied a class to the col groups in question, but the :hover isn't working:

 

CSS:

 

.added_name_col{}.added_name_col:hover{background-color: #CCFFF4;}

 

 

HMTL:

 

<colgroup>                <col/>                <col/>                <col class="added_name_col" />                <col class="added_name_col" />                <col/></colgroup>

 

 

 

Any idea how i can get this going?

 

 

Link to comment
Share on other sites

I don't think this is something that can be done very easily. I'm pretty sure that the col element doesn't put out an event for :hover (or mouseover in javascript), which means that you cannot do it directly.

 

The only way I can think of to do this would be to set a common class name for every td tag in a column. then using javascript, use onmouseover and get the class name, then set the background color for that class. That will get all the rest of the td tags in the column. You will also need to revert the background color onmouseout.

Link to comment
Share on other sites

http://www.soulbeams.net/webtech/css/remoterollover/

 

This is pretty advanced CSS to what i'm used to.... but could i apply one of these techniques to a table column?

 

No. The technique they are showing there relates to (and requires) parent <-> children relationships, but there is no parent <-> child grouping of columns in an HTML table, only rows.

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.