I want to enable link using CSS but still enable title. Here is my code:
CSS and HTML Code:
.disabledLink {
pointer-events: none;
opacity: 0.6;
cursor: default;
}
<a href="www.google.com" class="disableLink" title="My Title" />
<span datahover="test">My Link</span>
</a>
Unfortunately, title is not appearing when hovering my mouse to the link. Is there a better way to enable title?
titleattribute should be enough....pointer-events: none;is not perfect. It also disables other events such as hover, which is required for display of title="…" or tooltips. I found the JS solution is better (usingevent.preventDefault();"<span class="look-like-link" title="My Title">My Link</span>and.look-like-link{ text-decoration: underline; color: blue}