How to increase the clickable area of a tag button?

前端 未结 11 1641
悲哀的现实
悲哀的现实 2021-01-29 22:04

I have learnt from this post that always use tags or

11条回答
  •  南笙
    南笙 (楼主)
    2021-01-29 22:26

    For me the padding solution wasn't good, as I was using border on the button, and would've been hard to put modify the markup to create an overlay for the touch area.

    So what I did, is I just used the :before pseudo tag, and created an overlay, which was perfect in my case, as the click event propagated the same way.

    button.my-button:before {
        content: '';
        position: absolute;
        width: 26px;
        height: 26px;
        top: -6px;
        left: -5px;
    }
    

提交回复
热议问题