freelance84 Posted October 11, 2010 Share Posted October 11, 2010 .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 Quote Link to comment https://forums.phpfreaks.com/topic/215625-column-highlights-with-css/ Share on other sites More sharing options...
freelance84 Posted October 11, 2010 Author Share Posted October 11, 2010 http://www.search-this.com/2007/04/11/styling-table-columns-with-css/ Quote Link to comment https://forums.phpfreaks.com/topic/215625-column-highlights-with-css/#findComment-1121119 Share on other sites More sharing options...
freelance84 Posted October 11, 2010 Author Share Posted October 11, 2010 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? Quote Link to comment https://forums.phpfreaks.com/topic/215625-column-highlights-with-css/#findComment-1121126 Share on other sites More sharing options...
haku Posted October 12, 2010 Share Posted October 12, 2010 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. Quote Link to comment https://forums.phpfreaks.com/topic/215625-column-highlights-with-css/#findComment-1121332 Share on other sites More sharing options...
haku Posted October 12, 2010 Share Posted October 12, 2010 I actually just put together a little tutorial on the matter: http://www.jaypan.com/blog/highlighting-html-columns-jquery-and-css Quote Link to comment https://forums.phpfreaks.com/topic/215625-column-highlights-with-css/#findComment-1121351 Share on other sites More sharing options...
freelance84 Posted October 12, 2010 Author Share Posted October 12, 2010 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? Quote Link to comment https://forums.phpfreaks.com/topic/215625-column-highlights-with-css/#findComment-1121409 Share on other sites More sharing options...
freelance84 Posted October 12, 2010 Author Share Posted October 12, 2010 PS I'm only using Javascript when it is the only option available to me. If I can work around this with only using CSS i would much prefer. Quote Link to comment https://forums.phpfreaks.com/topic/215625-column-highlights-with-css/#findComment-1121413 Share on other sites More sharing options...
haku Posted October 12, 2010 Share Posted October 12, 2010 It cannot be done with CSS. Read the intro in my tutorial - it explains why. Quote Link to comment https://forums.phpfreaks.com/topic/215625-column-highlights-with-css/#findComment-1121439 Share on other sites More sharing options...
haku Posted October 12, 2010 Share Posted October 12, 2010 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. Quote Link to comment https://forums.phpfreaks.com/topic/215625-column-highlights-with-css/#findComment-1121442 Share on other sites More sharing options...
freelance84 Posted October 12, 2010 Author Share Posted October 12, 2010 hmm. Well, I'll be using the javascript version then i reckon. Thanks Quote Link to comment https://forums.phpfreaks.com/topic/215625-column-highlights-with-css/#findComment-1121505 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.