Reputation: 21292
Example:
<style> div.Style1 div img { border: 3px red solid } </style>
...
<div class="Style1" id="divMain">
<img src="http://someurl.com/someimg.jpg" /> <!--WON'T be styled-->
<div id="divSub">
<img src="http://someurl.com/someimg.jpg" /> <!--WILL be styled-->
</div> <!--End of divSub-->
</div> <!--End of divMain-->
Upvotes: 1
Views: 92
Reputation: 8141
Try this, it selects only images that are children of a div that are themselves children of the element with class Style1
.
.Style1 > div > img {
border: 3px red solid
}
Upvotes: 1
Reputation: 28598
Yes. This CSS:
div.Style1 div img {
border: 3px red solid;
}
says: apply border: 3px red solid;
to all img
elements within a div
element, which are in turn in in another div
that has Style1
as a class.
Here's a jsfiddle to demonstrate:
Upvotes: 3
Reputation: 449415
Yes, it is possible - try it out. Although I would use
div.Style1 div.divSub img { ... }
Upvotes: 1