Can I have an onclick effect in CSS?

后端 未结 12 1802
悲&欢浪女
悲&欢浪女 2020-11-21 06:42

I have an image element that I want to change on click.


This works:

#btnLeft:hover {
    width:7         


        
12条回答
  •  猫巷女王i
    2020-11-21 07:39

    TylerH made a really good answer, I just had to give that last button a visual update.

    .btn {
        border-radius: 5px;
        padding: 10px 30px;
        box-shadow: 1px 1px 1px #000;
        background-image: linear-gradient(to bottom, #eee, #ffffd);
    }
    
    .btn:hover {
        background-image: linear-gradient(to top, #adf, #8bf);
    }
    
    .btn:active {
        margin: 1px 1px 0;
        box-shadow: -1px -1px 1px #000;
    }
    
    #btnControl {
        display: block;
        visibility: hidden;
    }
    
    

提交回复
热议问题