使用css禁用链接 [英] Disable link using css

查看:132
本文介绍了使用css禁用链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有什么办法禁用使用CSS的链接?

Is there any way to disable a link using CSS?

我有一个类 current-page

推荐答案

答案已经在问题的意见。为了提高曝光率,我在此处复制此解决方案

The answer is already in the comments of the question. For more visibility, I am copying this solution here:

<a href="link.html" class="not-active">Link</a>

.not-active {
   pointer-events: none;
   cursor: default;
}

示例: http://jsfiddle.net/7EQJp

有关浏览器支持,请参阅: http://caniuse.com/#search=pointer-events *,如果您需要支持IE,还有一个解决方法,请参阅此回答

For browser support, please see: http://caniuse.com/#search=pointer-events*, if you need to support IE there is a workaround, see this answer.

警告:使用指针事件是实验性的。这个特性曾经是CSS3 UI草案规范的一部分,但由于许多开放的问题,已经推迟到CSS4。*

Warning: The use of pointer-events in CSS for non-SVG elements is experimental. The feature used to be part of the CSS3 UI draft specification but, due to many open issues, has been postponed to CSS4.*

这篇关于使用css禁用链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆