Forum Moderators: open
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.
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
[msdn.microsoft.com...]
Other than that, to retain font, try a DHTML tool tip script.