On 19 Jul 14:48, Mark Rogers wrote:
I can't quite get my head around this (hopefuly) related question:
If I have a table containing rows of cells which may contain checkbox input fields, how can I configure the CSS so that the background colour of the row depends on whether the checkbox is ticked?
I guess it's something like tr + td + input[type=checkbox]:checked { background-color: red; } but I haven't quite worked it out yet.
Basically I want ticking the checkbox (which is at the far right of a row) to highlight the whole row to make it obvious which row has been selected. It sounds like the right combination of siblings and selectors would do this.
There is no pseudo element called :checked, as far as I'm aware you can't get the state of a checkbox directly in css.
Also, that would be tr > td > input[type=checkbox].
You're going to be stuck with some simple javascript for this I believe.
Cheers,