如何使用css在最后一个li中隐藏hr

时间:2020-12-21 09:45:55

I need to hide the <hr> inside the last <li>

我需要在最后一个

  • 中隐藏

  • <div class="search-wrappper">
       <ul>
          <li>
             <a href="#">
                <h3>Headline</h3>
                <p class="ellipses">Lorem ipsum dolor sit amet Lorem ipsum dolor Lorem ipsum dolor  sit amet Lorem ipsum dolor sit amet</p>
             </a>
             <hr />
          </li>
          <li>
             <a href="#">
                <h3>Headline</h3>
                <p class="ellipses">Lorem ipsum dolor sit amet Lorem ipsum dolor sit ametLorem ipsum dolor sit amet</p>
             </a>
             <hr />
          </li>
          <li>
             <h3>Headline</h3>
             <p class="ellipses">Lorem ipsum dolor sit amet Lorem ipsum dolor sit amet Lorem ipsum dolor sit ametLorem ipsum dolor sit amet dolor sit amet  dolor sit amet </p>
             <hr />
          </li>
          <li>
             <h3>Headline</h3>
             <p class="ellipses">Lorem ipsum dolor sit amet Lorem ipsum dolor sit amet Lorem ipsum Lorem ipsum dolor  dolor sit amet Lorem ipsum dolor sit amet Lorem ipsum dolor sit amet </p>
    


    I can target the last li using following css

    我可以使用以下css定位最后一个li

    .search-wrapper > ul > li:last-child {
      background: red;
    }
    

    I am not sure how to hide hr tag inside this last li

    我不知道如何在最后一个li中隐藏hr标签

    1 个解决方案

    #1


    You can select the child by

    你可以选择孩子

    .search-wrapper > ul > li:last-child hr{
    

    you can also use

    你也可以用

    .search-wrapper > ul > li:last-child > hr{
    

    #1


    You can select the child by

    你可以选择孩子

    .search-wrapper > ul > li:last-child hr{
    

    you can also use

    你也可以用

    .search-wrapper > ul > li:last-child > hr{