Combine :after with :hover

前端 未结 3 1715
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-11-29 16:54

I want to combine :after with :hover in CSS (or any other pseudo selector). I basically have a list and the item with the selected cl

3条回答
  •  無奈伤痛
    2020-11-29 17:11

    Just append :after to your #alertlist li:hover selector the same way you do with your #alertlist li.selected selector:

    #alertlist li.selected:after, #alertlist li:hover:after
    {
        position:absolute;
        top: 0;
        right:-10px;
        bottom:0;
    
        border-top: 10px solid transparent;
        border-bottom: 10px solid transparent;
        border-left: 10px solid #303030;
        content: "";
    }
    

提交回复
热议问题