Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Style to an Alt tag 1

Status
Not open for further replies.

zbphill

Technical User
Jan 30, 2007
40
US
Is there away to put a style on an Alt tag.
 
Not the default one. You can simulate an alt tag with a div and make it look however you want though.

[monkey][snake] <.
 
There is no such thing as an alt tag.

There is an alt attribute for img tags, but it is just that - an attribute.

I am assuming you are refering to the way in which IE uses the alt attribute of an image as a tooltip. It's well documented that IE shouldn't do this as this is the job of the title attribute. The alt attribute should only be displayed if the image doesn't load.

So, if you want to style the text that shows if the image doesn't load then yes you can do this. Just apply some color & font styling to the image or place it within another element and style that.

For example. If I am using an image for a company logo in a header I might do

Code:
<h1><img src="companylogo.gif" alt="Big Company Ltd" /></h1>

Then create a CSS rule for that <h1>

Code:
h1 {
  font-size:20px;
  color: #ff9933;
  font-weight:bold;
}

<honk>*:O)</honk>

Earl & Thompson Marketing - Marketing Agency Services in Gloucestershire
 
I didn't know that Foamcow, learn something new everyday. However, in (at least IE6) font-color changed, but not weight or size. Worked in FF though.

[monkey][snake] <.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top