Unfortunately, it is not possible to select a parent when the child hangs using only CSS. This will prevent cascading in cascading style sheets. However, you could accomplish this using JavaScript or one of the libraries like jQuery quite easily.
If you intend to use jQuery, the following will provide the result you are looking for:
http://jsfiddle.net/fSqSx/
source
share