我想使用 CSS 启用链接但仍启用标题。这是我的代码:
CSS 和 HTML 代码:
.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>
不幸的是,当我将鼠标悬停在链接上时,标题没有出现。有没有更好的方法来启用标题?
最佳答案
.disabled-link {
pointer-events: none;
}
<span datahover="test" title="My Title"><a href="www.google.com" class="disabled-link">My Link</a></span>
将您的标记更改为此。它会起作用。而不是定位 <a>
标签,我将标题的范围作为目标。希望对您有所帮助。
关于html - 使用 CSS 禁用链接但启用标题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39892608/