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
https://forums.phpfreaks.com/topic/215625-column-highlights-with-css/
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?

 

 

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.

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.