Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/89.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 多条件属性选择器_Javascript_Html_Css - Fatal编程技术网

Javascript 多条件属性选择器

Javascript 多条件属性选择器,javascript,html,css,Javascript,Html,Css,我有一些故事的链接,有些是pdf格式的,有些是特别版的。特别版在其href中以特别版作为前缀 这是我的应用程序的简化html部分 <div class='container-node'> <a href='1.pdf'>Story 1</a> <a href='2.pdf'>Story 2</a> <a href='3.pdf'>Story 3</a> <a href='special-editio

我有一些故事的链接,有些是pdf格式的,有些是特别版的。特别版在其href中以特别版作为前缀

这是我的应用程序的简化html部分

<div class='container-node'>
 <a href='1.pdf'>Story 1</a>
 <a href='2.pdf'>Story 2</a>
 <a href='3.pdf'>Story 3</a>
 <a href='special-edition1.pdf'>Special Edition 1</a>
 <a href='4.pdf'>Story 4</a>
 <a href='special-edition2.pdf'>Special Edition 2</a>
</div>

您可以简单地将属性选择器与另一个not属性选择器组合使用,如下所示

a[href$=".pdf"]:not([href*="special-edition"]){
 background-color: #ADD8E6 ;
}

a[href$=”.pdf“]:不是([href*=“特别版”]){
背景色:#添加8e6;
}
.容器节点{
背景色:#32CD32;
}
a[href$=".pdf"]:not([href*="special-edition"]){
 background-color: #ADD8E6 ;
}