I have some html anchor link code, and unlike the rest of document I want it to look like it is not a link.
Is there a simple way to disable the style change caused by wrapping text in a anchor tag without having to brute force it to be the same (ie, if I change the body font style I don't have to also change some other :link stuff).
By setting the text-decoration to none to remove the underline from anchor tag. Syntax: text-decoration: none; Example 1: This example sets the text-decoration property to none.
You can always use tabindex="-1" inside your anchor tag in order to disable it.
Set red color to the text using the hex code #FF0000 . Then, set the text-decoration property to none . The CSS below will set the text Next Page to red which is a hyperlink. The text-decoration property, which is set to none , will remove the underline and blue color of the element of the anchor tag.
The best way to disable a link tag is by using the CSS property pointer-events: none; . When you apply pointer-events: none; to any element, all click events will be disabled. Because it applies to any element, you can use it to disable an anchor tag. By using a CSS class, you can disable multiple anchor tags at once.
Setting color to black and text-decoration to explicitly none is a little more aggressive than worked for me.
I was looking for the CSS of the anchors to be "benign" and just blend into the existing CSS. Here's what I went with:
a.nostyle:link { text-decoration: inherit; color: inherit; cursor: auto; } a.nostyle:visited { text-decoration: inherit; color: inherit; cursor: auto; }
Then I just added the CSS nostyle class to the anchors that I wanted to be unformatted.
I achieved this by creating a class .reset-a
and targeting all of its' pseudo classes.
Targeting of all pseudo classes is important to make it flawless.
outline: 0
property removes the dotted border that surrounds a link when it is focused or active.
.reset-a, .reset-a:hover, .reset-a:visited, .reset-a:focus, .reset-a:active { text-decoration: none; color: inherit; outline: 0; cursor: auto; }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With