使用css禁用链接 [英] Disable link using 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://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屋!