html - 禁用 Anchor 标签并在鼠标悬停时显示 title-msg 为什么它被禁用
问题描述
我想禁用 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>
推荐阅读
- firebase - 如何在安全规则中将我的文档中的字段设置为时间戳或 null?
- reactjs - 将映射状态反应到列表项
- html - HTML CSS,SVG FILL 不工作,完整示例和 jsfiddle
- python - Flask DateTime 包
- python - if 语句:数组是否有单位/维度(品脱)
- javascript - 获取网站的活动 Websocket 可能吗?
- python - Django Web App Heroku Deployement:没有为 decouple==0.0.7 找到匹配的分布
- java - 实现网络线程比使用加载器或 AsyncTask 更好的方法
- hive - Apache Hive 分区和分桶结构
- laravel - Laravel - 根据文件的完整路径获取视图名称