Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/84.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
Html 如何仅显示具有相同名称的一个类_Html_Css - Fatal编程技术网

Html 如何仅显示具有相同名称的一个类

Html 如何仅显示具有相同名称的一个类,html,css,Html,Css,在我的代码中 <ol class="items"> <li class="item"> <span class="filter-label">Category</span> <span class="filter-value">Fashion</span>

在我的代码中

<ol class="items">            
    <li class="item">
       <span class="filter-label">Category</span>
       <span class="filter-value">Fashion</span>                                                                                                                                                    
       <a class="action remove" href="https://www.marketplacedemo.store/online-store?cat=226" title="Remove Category Fashion">
           <span>Remove This Item</span>
       </a>                                                                    
    </li>            
    <li class="item">
        <span class="filter-label">Category</span>
        <span class="filter-value">Deal of day-Home</span>                                                                                                                               
        <a class="action remove" href="https://www.marketplacedemo.store/online-store?cat=109" title="Remove Category Deal of day-Home">
           <span>Remove This Item</span>
         </a>                                               
    </li>
</ol>
但它不起作用


如何仅显示一个类别?非常感谢您提供的任何帮助。您可以使用
:not
选择器来实现这一点

.items li:不是(:第一个子项)。筛选标签{
显示:无;
}

  • 类别 时尚
  • 类别 每日交易之家
  • .filter-label{
        display:none;
    }
    .items:nth-of-type(1) >.filter-label:first-child {
      display:block;
    }