Reputation:
This is my html:
<div id="content">
<img src="myimg.png" alt="this image need to select"/>
<div class="some">
<img src="another.png" alt="this is not need to select"/>
</div>
</div>
I want to select all image which are inside id content
but not which are inside the div
or span
of content
div i.e. select all image directly inside the content
div and not the ones that are inside the div
or span
of content div.
Any thoughts?
Upvotes: 0
Views: 18645
Reputation: 382696
You can use >
to select direct/immediate children of the div like this:
#content > img{
// target direct children
}
More Info:
Upvotes: 10