How to disable a link using only CSS?

前端 未结 22 3417
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-11-22 02:58

Is there any way to disable a link using CSS?

I have a class called current-page and want links with this class to be disabled so that no action occurs

22条回答
  •  天命终不由人
    2020-11-22 03:21

    Another trick is to place a invisible element above it. This will disable any hover effects as well

    .myButton{
        position: absolute;
        display: none;
    }
    
    .myButton::after{ 
        position: absolute;
        content:"";
        height:100%;
        width:100%;
        top:0;
        left:0;
    }
    

提交回复
热议问题