1

I have the need to disable a link via css, can this be done if the link is visible and holds a valid 'href' attribute value?

html:

<a class="theLink" href="https://ebay.com">link</a>

css:

.theLink{...?}
  • Please search before you ask a question, there is an already existing answer that is easily found by a simple search. – Jacob G Oct 29 '15 at 12:22

2 Answers2

1
.thisLink{
   pointer-events: none;
   cursor: default;
}

Here is an example

m0bi5
  • 8,900
  • 7
  • 33
  • 44
1

Yes you can disable it!

html:

<a class="theLinkDisabled" href="https://google.com">link</a>
<br>
<a class="theLinkActive" href="https://google.com">link</a>

css:

.theLinkDisabled{
    pointer-events: none;
    cursor:default;
}

.theLinkActive{
    pointer-events: auto;
    cursor:pointer;
}
Al Ex Tsm
  • 2,042
  • 2
  • 29
  • 47