Forum Moderators: open

Message Too Old, No Replies

line breaks in the "title" attribute on img tags?

         

Bad80sHair

5:59 pm on Aug 31, 2003 (gmt 0)

10+ Year Member



cut a long story short, my client has large passages of text that he wants as an image, to retain his font and formatting etc.

is there a way that, for accessibility's sake, i can transcribe the text into the img's "title" attribute and retain all the line breaks?

the things we do for clients...

pageoneresults

6:06 pm on Aug 31, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



cut a long story short, my client has large passages of text that he wants as an image, to retain his font and formatting etc.

Is there anything you can do? Yup, time to fire that client. He wants to take one of the most important elements on the page, the actual content, and turn it into an image because of the font style he/she wants to use?

Now it is your job as a professional to counteract their want with sound advice on why not having that text in an image is the best thing to do.

Also keep in mind, that the Title Attribute or Alt Text are to be short and to the point and describe the image and/or linked resource succinctly. It's not an area to replicate a whole story as it sounds like this client wants to do.

No, you cannot control the line breaks in alt or title content. The other thing you cannot control is how long that alt text or title content stay visible once you hover. I've seen people try to stuff entire pages into one alt tag and you get this huge piece of alt text that pops up for a few seconds and then poof, its gone! If what you needed to say cannot be said in that short period of alt text/title attribute display time, then what purpose does it serve?

In your case, it sounds like you will need to use the longdesc attribute for the image. Anytime your alt text surpasses 80 characters, the longdesc attribute is recommended.

MonkeeSage

6:17 pm on Aug 31, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



In IE6 and Mozilla, but not Opera, line breaks in the source are preserved and displayed in the title attribute, or it can be set with JS like
document.getElementById("img").title = "This is some text \nwith line breaks \npreserved".
But as pageoneresults said, it's kind of pointless to stuff wads of text into the title attribute when its gone too quickly to read. You just end up with annoyed visitors trying to hover 50 times just to see what the darned thing says, or more likely, hovering once and never bothering to even try to read the rest.

Jordan

hartlandcat

9:11 pm on Aug 31, 2003 (gmt 0)

10+ Year Member



Do not put large passages of text in an image. Tell that client that it will cause the page to take all night to load, causing people to get bored of waiting and leave.

What's so amazing about his font formatting anyway?

gph

4:46 am on Sep 1, 2003 (gmt 0)

10+ Year Member



This is simple and flexible but very browser specific, IE5.5+

[msdn.microsoft.com...]

Other than that, to retain font, try a DHTML tool tip script.