查看此图片...
每个社交图标上都有一个标题标签。我正在尝试更改标题标签所在的气泡的背景颜色。
我试过这个...
a[title]:hover:after { background: #8b6ab2; }
但它不起作用。有没有通用的方法可以做到这一点,还是必须基于网站动态?
最佳答案
我是这样做的。
<a href="#" title="This is the title to show">hover here</a>
<style type="text/css">
a[title]:hover:after{
content: attr(title);
background: red;
position: absolute;
left: 5%;
top: 10%;}
</style>
您可以使用这样的数据属性隐藏默认标题
<a href="#" data-title="This is the title to show">hover here</a>
<style type="text/css">
a[data-title]:hover:after{
content: attr(data-title);
background: red;
position: absolute;
left: 5%;
top: 10%;
}
</style>
查看更多here
关于html - 如何更改标题标签的背景颜色?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25390463/