I have a child div which has been effected by .img class.
Although I insert :not selector for this div as
.main .content .index-exp .img:not(.view-image)
Based on the markup provided, it looks like your selector should be:
.main .content .index-exp .img img:not(.view-image) {}
Updated Example
The img
elements with a class of .view-image
were descendants of .img
elements (they didn't contain the .img
class themselves). You were trying to negate elements with a class of .view-image
and .img
rather than elements with a class of .view-image
and a tag type of img
.
Alternatively, the following work work as well:
.main .content .index-exp img:not(.view-image) {}
.index-exp .img img:not(.view-image){ }
(a little faster)