Firefox does not seem to support line feeds in the title attribute. I have tried \r
, \r\n
, \n
, 
,
, and still found nothing that works.
Does anyone have a h开发者_JAVA百科ack to get around this?
There is nothing is the spec about how exactly browsers have to display the value in title attributes.
Is simply says:
Values of the title attribute may be rendered by user agents in a variety of ways. For instance, visual browsers frequently display the title as a "tool tip"
(Emphasis mine)
So, not only is there nothing about line breaks, but the actual behavior of "tool tip" is not mandatory.
Firefox doesn't support this. On other browsers like Chrome, just use return.
<a href="..." title="My
long
title">My link</a>
Alternatively you could use the JQuery Tooltip Plugin. It works in all browsers and let's you use html in your tooltips.
精彩评论