链接:not选择器不适用于子div [英] Chained :not selector does not working for child div

查看:85
本文介绍了链接:not选择器不适用于子div的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个由.img类影响的子div。



虽然我插入了这个div的选择器不是

  .main .content .index-exp .img:not(.view-image){/ * rest * /} 



它仍然会影响我的div。



这里是



<$ c $具有 .view-image 类的 img 元素是 .img 元素(它们不包含 .img 类本身)。你试图用 .view-image .img 而不是具有 .view-image 类别和 img 标签



或者,以下工作也可以工作:

 。 main .content .index-exp img:not(.view-image){} 


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){ /*rest*/ }

it is still effecting my div.

Here is http://jsfiddle.net/x80vm7y8/15/ address.

Could it be bug?

My result

Expected result is

解决方案

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) {}

这篇关于链接:not选择器不适用于子div的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆