HTML属性的长度问题_html/css_WEB-ITnose

WBOY
Release: 2016-06-24 11:53:49
Original
1553 people have browsed it

越来越多的同学喜欢把数据存放在html属性上,比如

<p data-info="{a:1,b:2}">xxx</p>
Copy after login

一堆JSON数据放在data-info里。存放的属性值有长度限制吗?如果有最大长度是多少?

 

分别从HTML4和HTML5的规范去查看。

HTML4

3.2.2节介绍Attribute,里面没有提到长度的限制。

 

SGML

HTML4来源于SGML,看看SGML有没有这方面的规定。

貌似最大是65536。

 

HTML5

3.2.3.1 Attributes 里也没有提到长度显示。

 

当然,用各浏览器测试下是最好的结论。

 

相关:

http://www.w3.org/TR/html401/intro/sgmltut.html#h-3.2.2

http://www.w3.org/TR/html401/sgml/sgmldecl.html

http://www.highdots.com/forums/html/length-html-attribute-175546.html

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!