【推荐教程:CSS视频教程 】
纯CSS实现tooltip,css更改html标签的title样式【笔者有时间会更新一些边界条件。目前的样式在极端情况是有问题的,请不要直接将代码copy到线上环境,这只是笔者写的一个小demo】
html代码:
以下代码直接可用,tootip的样式可以自己调试。
Document*{
margin: 0;
padding: 0;
}
.box {
display: flex;
justify-content: center;
align-items: center;
}
span {
position: relative;
margin: 50px auto;
border: 1px solid;
}
span[aria-label]:hover:after {
content: attr(aria-label);
position: absolute;
bottom: -30px;
left: 0;
border: 1px solid;
width: 100%;
}
我是主体内容啊
更多编程相关知识,请访问:编程教学!!