Onclick CSS button effect

前端 未结 4 2100
梦毁少年i
梦毁少年i 2021-02-05 12:56

I\'m creating a CSS button and I\'m trying to make an onclick effect: when the user clicks on the button it would push down the button text by 1px. My problem here is that it\'s

4条回答
  •  后悔当初
    2021-02-05 13:44

    Push down the whole button. I suggest this it is looking nice in button.

    #button:active {
        position: relative;
        top: 1px;
    }
    

    if you only want to push text increase top-padding and decrease bottom padding. You can also use line-height.

提交回复
热议问题