我想禁用Anchor标签并在鼠标悬停时显示标题,为什么它被禁用?
<a href="domain.xyz" title="why it's disabled">sample domain</a>
试过以下:
.disabled {
opacity: 0.5;
cursor: default !important;
pointer-events: none !important;
}
但鼠标悬停不起作用。
有没有指针如何使用CSS?
您可以使用:after
显示content: attr(title)
元素以显示原因。
a.disabled {
cursor: not-allowed;
text-decoration: none;
}
a.disabled:hover::after {
content: attr(title);
padding-left: 10px;
color: black;
}
<a href="#" class="disabled" title="Unavailable now" onclick="return false">Click here</a>