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連接禁用樣式