CSS for elements ONLY under a specific id


I have a div element that has an id and this div contains a set of inputs and labels. I ONLY want to style the inputs inside this specific div but .. the following styles everything (global) instead of keeping the scope inside #ParentDiv

#ParentDiv label,input { display: inline; }

Also, is it possible to do this type of thing with valid css in IE6/7?

Best Solution

you need this:

#ParentDiv label, #ParentDiv input { display: inline; }

A comma indicates a new selector statement.

Often, so that I remember what each of the selectors is, and to make it easier to see what elements are being selected at a glance, I will alphabetize and break the selectors on two separate lines like so:

#ParentDiv input,
#ParentDiv label {
    display: inline;

Also, this should work just fine in IE 6/7/8, and is valid according to w3c.