Style button when :active different from :hover

前端 未结 3 331
深忆病人
深忆病人 2021-01-28 07:37

I want to make a button that displays a background color when hovering and a button color without a background color when the button is down. Here is my current code:

         


        
3条回答
  •  北海茫月
    2021-01-28 07:53

    How about this?

    I would guess, its cause on the first property you are using background-color and the second fill.

    button:hover {
        background-color: red;
    }
    button:active {
        background-color: blue;
    }
    

    jsFiddle working example (1)

提交回复
热议问题