Reputation: 6040
Here is the code:
<div id="divFrame"> <div> <img /> </div> <div> </div> <p> </p> </div>
I want to select all these elements. I have tried the following with no luck
#divFrame *
#divFrame > *
Any idea ?
Upvotes: 0
Views: 162
Reputation: 116180
Neither will select all elements. The first will select all descendants (children and grandchildren), while the second only selects the children of the div, namely the two divs and the p, but not the img. Neither will select #divFrame itself.
To select them all, you will need
#divFrame, #divFrame *
This is actionally a combination of two selectors. The first selects #divFrame while the second selects all its descendants.
Upvotes: 2
Reputation: 10619
You forgot to close one of your div
so your code is not working.
I want to select all these elements.
Use div, img, p
Upvotes: 0
Reputation: 6672
I want to select all these elements
#divFrame, #divFrame div, #divFrame img, #divFrame p
{
property: value;
}
Upvotes: 1