使用CSS样式化图像标题属性? [英] styling an image title attribute using css?
本文介绍了使用CSS样式化图像标题属性?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当我们将鼠标悬停在图片上时,我想对我们看到的文字进行风格设置。我尝试以下但不工作:
I want to style the text we see when we hover over the image. I tried the following but it won’t work:
<body>
<img src="img.jpg" title = "<span class='title'> title </span>
</body>
我的风格是在 head
,我不知道为什么它被显示为纯文本,
My style is in head
. I wonder why it’s being shown as plain text and why style isn’t working.
推荐答案
没有什么不可能。编辑 Andres Ilich的解决方案问题:如何更改锚定标签中Title属性的样式?
Nothing is impossible. edited the solution by Andres Ilich to the question: How to change the style of Title attribute inside the anchor tag?
a {
color: #900;
text-decoration: none;
}
a:hover {
color: red;
position: relative;
}
a[data]:hover:after {
content: attr(data);
padding: 4px 8px;
color: rgba(0,0,0,0.5);
position: absolute;
left: 0;
top: 100%;
white-space: nowrap;
z-index: 2;
border-radius: 5px ;
background: rgba(0,0,0,0.5);
}
<a data="This is the CSS tooltip showing up when you mouse over the link"href="#" class="tip">Link</a>
这篇关于使用CSS样式化图像标题属性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文