Pressed <button> selector

后端 未结 5 1306
小鲜肉
小鲜肉 2020-11-27 03:58

I\'d like to create a button that changes its style when it gets pressed. This is my CSS code:

5条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-11-27 04:32

    Maybe :active over :focus with :hover will help! Try

    button {
    background:lime;
    }
    
    button:hover {
    background:green;
    }
    
    button:focus {
    background:gray;
    }
    
    button:active {
    background:red;
    }
    
    

    Then:

    
    

    Then:

    
    
    
     Sorry about that last one. :) I was just showing you a cool function! 
    Wait... did I just emphasize a code block? This is cool!!!

提交回复
热议问题