Welcome to Delicate template
Header
Just another WordPress site
Header

HTML中title标签换行解决方案

11月 8th, 2011 | Posted by 无 名 in html

需要换行的地方,加入如下字符 (回车键,/n)或着 (换行键,即/r)即可。

如:

<a href="some_url" title="one&#13;two&#13;three">please move on me!</a>

备注:
可惜这种方法只能够在ie(或者chrome)里面,firefox不买账,网上搜索了,发现w3c的对于title的规范如下:

The (X)HTML DTDs define the contents of the title attribute as CDATA for which the W3C states:
User agents should interpret attribute values as follows:

Replace character entities with characters,
Ignore line feeds,
Replace each carriage return or tab with a single space.

也就是说,title里面只能够存在普通字符,能够变成标签的都成为普通字符,去掉换行符号,将回车符号变成空格,而firefox遵循这个w3c原则,所以在firefox里面没有办法通过这么简单的方法来实现换行了。

You can follow any responses to this entry through the RSS 2.0 Both comments and pings are currently closed.