Reputation: 47
I need to change text styles in alt
tag.
For example:
<img alt="Logo" src="images/logo.jpg" />
and I need change to size and color this alt (alt="Logo").
Please, what should I do?
Upvotes: 0
Views: 1780
Reputation: 1477
<span class="styleMe"><img src="..." alt="..." /></span>
If you have done your code right, you should NEVER see the alt text.
Upvotes: 0
Reputation: 3677
The reason of the ALT Attribute it to specify what image would be where the image is currently, if an error occurs, the image cannot be loaded, or the image cannot be found. Your Browser then interprets the ALT Tag and outputs it's value... For example.
<img src="images/images.png" alt="An Image Should Be Here" />
If NO Error Occurs and the image CAN be found, etc., your browser will display the Image properly. If an error occurs or the image cannot be found it will display with ALT Text in location where your image should be. The Style of the ALT Text (if displayed) can be defined via CSS. But, usually the browser's default value will display the ALT Text in it's pre-defined manner.
I haven't used ALT Tags to display text of an image onHover, but I have used the TITLE tag to display text of an image onHover.
If you are interested in styling the "Tool-Tip" per se, you may always check out various jQuery/JavaScript plugins and HTML Events to reach what you are gunning for... For example:
http://jquerytools.org/demos/tooltip/index.html
jQuery Tools > Tooltip Plugin
I hope this all helps my friend, Thanks, Aaron
Upvotes: 0
Reputation: 499382
I am assuming you mean the tooltip the browser puts up for the text in the alt
attribute.
You can't control that directly apart from changing the text itself.
There are Javascript libraries that will allow you to write custom tooltips - lots of jQuery plugins.
Update:
If you mean the text that appears if the image cannot be found, you can use normal CSS rules for fonts and colors to control this.
Upvotes: 4
Reputation: 1383
alt
tooltips cannot be styled directly.
You can however implement your custom tooltips like this plugin: jQuery Tooltip
Upvotes: 0
Reputation: 511
did you try setting the font for the img tag? I'm pretty sure I've done it that way in the past.
<img ... style="font-size: 150%; color: red;"/>
Upvotes: 0
Reputation: 8389
This is not an exact answer. Its a suggestion. You may probably like tooltip plugins
to get the desired functionality as specified in this page.
Upvotes: 0
Reputation: 11982
If you mean the text, which is shown, when no image is availble – just use CSS, for example:
img {
font-size:20px;
line-height:1.3em;
color:#ff0000;
}
Upvotes: 2