Max length of an HTML attribute value

前端 未结 3 544
故里飘歌
故里飘歌 2020-12-20 15:35

How would I know what the maximum length of an element\'s attribute value is?

e.g.

What\'s

相关标签:
3条回答
  • 2020-12-20 16:07

    According to this page, technically unlimited. An actual test in various browsers will show their limits but my guess is the limit would be unreasonably long.

    0 讨论(0)
  • 2020-12-20 16:11

    According to the SGML Declaration of HTML 4, the limit could be 65536 characters:

    ATTSPLEN 65536   -- These are the largest values --
    LITLEN   65536   -- permitted in the declaration --
    NAMELEN  65536   -- Avoid fixed limits in actual --
    PILEN    65536   -- implementations of HTML UA's --
    

    The LITLEN limits the number of characters which can appear in a single attribute value literal and the ATTSPLEN limits the sum of all lengths of all attribute value specifications which appear in a tag.

    Apparently, the limits used to be much lower in HTML 2, and people were complaining back then in 1995.

    0 讨论(0)
  • 2020-12-20 16:12

    Beyond any practical need.

    I use ASP webforms regularly, and often have 100+ character ID's.

    0 讨论(0)
提交回复
热议问题