Multiple CSS Pseudo Classes

后端 未结 5 685
攒了一身酷
攒了一身酷 2020-12-09 14:22

What is the proper CSS syntax for applying multiple pseudo classes to a selector. I\'d like to insert \",\" after each item in a list except the last one. I am using the f

5条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-09 15:18

    You can get around this by having a another tag inside the

  • and apply the :after to that instead. That way you would be applying the :last-child and :after to different elements:

    ul.phone_numbers li > span:after {
        content: ",";
    }
    
    ul.phone_numbers li:last-child > span:after {
        content: "";
    }
    

提交回复
热议问题