[ACCEPTED]-CSS: How to target all elements within a given ID-css

Accepted answer
Score: 22

Actually yes, exactly like you mentioned.

#container * { color: red; }

0

Score: 4
#container * {color: red;}

Should work.

If you only want direct children 2 to get the class, try

#container>*{color: red;}

What browser are you 1 using? (brand + version)

Score: 2

I would have thought:

#container * {color: red;}

Should work.

0

Score: 0

For your example, can you use jQuery?

$('#container').children().css('color', 'red');

EDIT: I 3 was indeed wrong, serves me right for trying 2 to answer on my lunch break with half a 1 sandwich in my hand -.-

More Related questions