Highlight rows with CSS
Highlight rows with CSS
Ralf
Posts: 4Questions: 0Answers: 0
Hi,
I have a problem to highlight a row on mouseover with css. After hours I found out that the reason for this is the doctype in my project.
Because I can't use the strict mode of the browser (IE6+ only) I write the following line to the beginning of my documents:
"[code]<! DOCTYPE HTML PUBLIC "- / / W3C / / DTD HTML 4.01 Transitional / / EN">[/code]
With this entry, my web pages look good, but it is not possible to highlight a row with CSS
This entry, however works fine (see example http://datatables.net/examples/advanced_init/highlight.html), but my websites look very bad:
"[code]<! DOCTYPE HTML PUBLIC "- / / W3C / / DTD HTML 4.01 Transitional / / EN " "http://www.w3.org/TR/html4/strict.dtd">[/code]
Have anyone an idea how to highlight a row with css on mouse over with my docType?
Thanks, Ralf
Sorry for my English, it is not my favorite language :-)
I have a problem to highlight a row on mouseover with css. After hours I found out that the reason for this is the doctype in my project.
Because I can't use the strict mode of the browser (IE6+ only) I write the following line to the beginning of my documents:
"[code]<! DOCTYPE HTML PUBLIC "- / / W3C / / DTD HTML 4.01 Transitional / / EN">[/code]
With this entry, my web pages look good, but it is not possible to highlight a row with CSS
This entry, however works fine (see example http://datatables.net/examples/advanced_init/highlight.html), but my websites look very bad:
"[code]<! DOCTYPE HTML PUBLIC "- / / W3C / / DTD HTML 4.01 Transitional / / EN " "http://www.w3.org/TR/html4/strict.dtd">[/code]
Have anyone an idea how to highlight a row with css on mouse over with my docType?
Thanks, Ralf
Sorry for my English, it is not my favorite language :-)
This discussion has been closed.
Replies
[code]
#ResultsTable tr.even:hover{
background-color: #cccccc;
}
#ResultsTable tr.odd:hover{
background-color: #cccccc;
}
[/code]
Regards,
Vivek
does not work. It is principle the same as in the example
[code]
ex_highlight #example tbody tr.even:hover, #example tbody tr.even td.highlighted {
background-color: #ECFFB3;
}
.ex_highlight #example tbody tr.odd:hover, #example tbody tr.odd td.highlighted {
background-color: #E6FF99;
}
[/code]
It definitely works after adding the entry in the header, unfortunately, with the effect the website look bad, .
[code]http://www.w3.org/TR/html4/strict.dtd[/code]
Greetings Ralf
[code]
$("#DATATABLE_TABLE tbody tr").each(function(){
$(this).mouseover(function(){
$(this).addClass("ui-state-hover");
}).mouseout(function(){
$(this).removeClass("ui-state-hover");
});
});
[/code]
with or without UI, the same effect: No highlightning
The function is OK, the alert shows the right id ...
[code]
$("#myDataTable tbody tr").each(function(){ $(this).mouseover(function(){
alert($(this).attr('id'));
$(this).addClass("ui-state-hover");
}).mouseout(function(){
$(this).removeClass("ui-state-hover");
});
[/code]
With the link in the docType definition it works ...
Ralf
I'd suggest using live() events for your mouse over (also don't bother with the 'each' jQuery does that for you, so it's faster without).
Allan
[code]
.hell {
background-color: #ECFFB3 !important;
}
[/code]
The Problem is that the 'sorted' cells (td's) will not be highlightet.
Ralf