Home  >  Article  >  Web Front-end  >  HTML attribute length problem_html/css_WEB-ITnose

HTML attribute length problem_html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-24 11:53:491601browse

More and more students like to store data in html attributes, such as

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

A bunch of JSON data is placed in data-info. Is there a length limit for stored attribute values? If there is a maximum length what is it?

View from the specifications of HTML4 and HTML5 respectively.

HTML4

Section 3.2.2 introduces Attribute, which does not mention the length limit.

SGML

HTML4 is derived from SGML. Let’s see if SGML has any regulations in this regard.

It seems that the maximum is 65536.

HTML5

3.2.3.1 Attributes There is no mention of length display.

Of course, testing with various browsers is the best conclusion.

Related:

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

Statement:
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