有谁知道我可以为 html title 属性输入的最大长度是多少以及是否允许使用特殊字符?
最佳答案
根据当前的 HTML 4 和 5 规范,标题长度没有限制;但 IE 浏览器对 HTML 4.01 的限制为 512 个字符.
其他浏览器有长标题的问题(每次都要自己测试)。此外,您几乎可以在标题中使用任何内容,包括字母、数字、特殊字符(符号)等。但要避免使用 Unicode。
Unicode 标题会带来一些麻烦。请参阅此 Stack Overflow 帖子 Unicode HTML titles displaying as boxes in IE, Chrome .
来自@Jukka K. Korpela 的评论:
The reason to avoid anything except the most common characters is that title attribute values are rendered, on mouseover, by browser routines that typically use a specific font, with limited character repertoire. There is no formal prohibition, just lousy implementations.
关于html - html 标题的最大长度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12139904/