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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to imitate in an "alt" property? 1

Status
Not open for further replies.

royboy75

Programmer
Feb 13, 2007
114
GB
Hello,

I would like to put some long text at the alt property of a certain element. Is it possible to include in this text some line breaks (i.e. <br>) so the text won't "spread" on the screen?
 
You're actually breaking the accessibility rules by putting a long description into an [tt]alt[/tt] attribute. I am not sure if you're aware of it, but alt attribute is used to display some information about the picture when user agent cannot render the picture. This it should be short and concise (for example 'company logo' or 'mother with child' or even empty, if the picture has only decorative purpose, e.g. '' instead of 'curvy corner of the top header').

I gather that you're actually talking about the [tt]title[/tt] attribute. Title is what appears as a tooltip when you hover over an element. If I recall correctly, there are many issues with browsers and that tooltip text already. FF will cut the text at one point regardless of the length and IE will simply format the tooltip so that it looks ok (will automatically restrict the length of the tooltip and flush the text in many lines). So, I think you don't have to do anything. If you still want to try, there is a method that might work in IE:
Code:
<img src="myDog.jpg" alt="My dog" title="This is my dog Fido.  He likes
to play in the garden, eat dog food and pee on the couch.  Sometimes
we take Fido for a walk and play frisbee with him." />

___________________________________________________________
[small]Do something about world cancer today: PACT[/small]
 
You are right, it is the title and doing nothing did the trick :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top