Can CSS uppercase the text shown for the title atribute?

一个人想着一个人 提交于 2019-12-12 10:53:38

问题


Let’s say we have:

<a id="link" href="#"  title="i am the title">link</a>

Is there a way to use CSS to uppercase the "i am the title" text that will be shown on mouse hover by default?


回答1:


Not that I'm aware of.

You can select an element by its attribute(s), but not select an attribute itself.

A little bit of JavaScript can do it, however...

var elem = document.getElementById('link');

elem.title = elem.title.toUpperCase();

jsFiddle.




回答2:


No - title like tooltips are browser dependant, CSS can't change them.

But here's a link that shows how you can make a fake tooltip look like you want with CSS only: How to change the style of Title attribute inside the anchor tag?




回答3:


I've got the solution, provided you are using jQuery.

Here's a live demo - http://jsfiddle.net/WzYkQ/



来源:https://stackoverflow.com/questions/8788109/can-css-uppercase-the-text-shown-for-the-title-atribute

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!