How to select multiple elements using CSS

I have the following markup:

I want to match the input and textarea elements from the div.c3 with only one CSS rule. I'm using

div.c1 .c2 .c3 input,textarea { border: 1px solid #f00; }

but this matches all textareas, not only the one cotnained in the c3 div.

Is this possible, or must I write separate CSS selectors for each element?

Look at http://jsfiddle.net/Bp3qn/1/ for the live example.


I updated http://jsfiddle.net/Bp3qn/3/

I only need the input and textarea contained in the c1->c2->c3 containers to be highlighted, not other combinations.

14
задан the Tin Man 30 March 2016 в 21:43
поделиться