如何选择特定类前缀的元素同时排除其他类前缀?
需求与CSS解决方案
需求:选中所有带有以post-type-开头的class的<body>元素,但当该元素同时带有以taxonomy-开头的class时,不选中它。
最初尝试的CSS代码(不可行)
body[class^="post-type-"], body[class*=" post-type-"] { &:not([class^="taxonomy-"]), &:not([class*=" taxonomy-"]) { .widefat { .check-column { display: none; } } } }
调整后可行的CSS代码
body[class^="post-type-"]:not([class^="taxonomy-"]):not([class*=" taxonomy-"]), body[class*=" post-type-"]:not([class^="taxonomy-"]):not([class*=" taxonomy-"]) { .widefat { .check-column { display: none; } } }
内容的提问来源于stack exchange,提问作者Gavin
相关产品推荐
相关产品推荐

