问题
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