css设置a连接禁用样式
Question:
题:
Links are one of the most essential aspects of any web page or website. They play a very important role in making our website or web page quite responsive or interactive. So the topic for discussion is quite perplexing, why would anyone want to disable the links from their web page websites? Even, if you do want to achieve that why did you include that link which you wish to remove from your website or a web page in the first place? This all sounds quite weird but one can only learn! Therefore, we should not ignore such challenging tasks and should try to come up with a solution to that problem.
链接是任何网页或网站的最重要方面之一。 它们在使我们的网站或网页具有快速响应性或交互性方面发挥着非常重要的作用。 因此,讨论的话题非常困惑,为什么有人要禁用其网页网站上的链接? 甚至,如果您确实想实现该目标,为什么还要首先添加要从您的网站或网页中删除的链接? 这一切听起来很怪异,但只能学习! 因此,我们不应忽略这些具有挑战性的任务,而应设法解决该问题。
Trivia:
琐事:
As said earlier links are very important in a web page or website because they help in navigation or to highlight some very crucial information on that website or web page and for many other purposes the links can be used. Links are the fundamental elements of the web pages or websites and must be included to make the websites or web pages to make them responsive or highly interactive. It is a very good practice to include various links in your page as your page or site appears to be very informative and a one-gateway to the other pages, which makes the work of the users quite easy and they will not have to search for that particular piece of information somewhere else when that information is just link away!
如前所述,链接在网页或网站中非常重要,因为它们有助于导航或突出显示该网站或网页上的一些非常关键的信息,并且出于许多其他目的,可以使用链接。 链接是网页或网站的基本元素,必须包含链接以使网站或网页具有响应性或高度交互性。 很好的做法是在页面中包含各种链接,因为您的页面或站点看起来非常有用,并且一个通往其他页面的网关,这使用户的工作变得非常容易,并且他们不必搜索当特定信息链接到其他地方时,该特定信息就会消失!
Although there are various steps and methods that you can use to disable links from your web page or website and those methods include JavaScript, HTML, etc but the focus here is to disable the link using CSS. You must be wondering about the solution by now, but there is nothing to worry about as the answer to this problem is quite very simple. So without much adieu let us move forward.
尽管您可以使用多种步骤和方法来禁用网页或网站上的链接,并且这些方法包括JavaScript,HTML等,但此处的重点是使用CSS禁用链接。 您现在肯定已经在想解决方案了,但是不必担心,因为对这个问题的答案非常简单。 因此,没有太多让步,让我们继续前进。
Answer:
回答:
To disable links using CSS, what you can do is you can set the pointer-events to none. That’s right, easy, isn’t it? All you have to do is set the pointer-events property of that particular link that you wish to remove from your site or web page to none and voila! The link is disabled. So go why don’t you go ahead and try this yourself. The syntax below might also help you.
要使用CSS禁用链接 ,您可以将指针事件设置为none。 是的,很简单,不是吗? 您所要做的就是将要从您的网站或网页中删除的特定链接的指针事件属性设置为none,瞧! 链接被禁用。 那么,为什么不继续尝试一下呢? 以下语法也可能对您有帮助。
Syntax:
句法:
Element{
pointer-events:none;
}
Example:
例:
<!DOCTYPE html>
<html>
<head>
<title>Disable Link using CSS</title>
<style>
.disabled {
pointer-events: none;
cursor: default;
}
</style>
</head>
<body>
<b>Disabled link:</b> visit our website <a href="https://www.includehelp.com/" class="disabled">IncludeHelp</a>
<br>
<br>
<b>Enabled link:</b> visit our wesbite
<a href="https://www.includehelp.com/"> IncludeHelp</a>
</body>
</html>
Output
输出量
In the above example, to view the difference move your cursor on the above two links and click on them.
在上面的示例中,要查看差异,请将光标移到以上两个链接上,然后单击它们。
Advice:
忠告:
Though, you must not disable links from your web page or website unless it is very necessary because why include them in the first place?
但是,除非非常必要,否则一定不要禁用网页或网站上的链接,因为为什么要首先包含它们?
翻译自: https://www.includehelp.com/code-snippets/disabling-a-link-using-css.aspx
css设置a连接禁用样式