Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

data-attributes is there a limit of length and how many?

Is there a limit on html's data-attribute? Is it possible to have many data-attributes on a tag?

ex. data-a="" data-b="" data-c="" ... data-z=""

And also is there a limit how long the value on each data-attribute?

like image 645
meetmahpuppy Avatar asked Sep 11 '14 16:09

meetmahpuppy


People also ask

How long can data attribute be?

416.58 (64 bits)), and data-attributes seem to have a limit of 64k.

Can you have multiple data attributes?

A data attribute is a custom attribute that stores information. Data attributes always start with “data-” then followed with a descriptive name of the data that is being stored. You can have multiple data attributes on an element and be used on any HTML element.


1 Answers

Every HTML element may have any number of custom data attributes specified, with any value.

Source: w3.org: 3.2.5.9 Embedding custom non-visible data with the data-* attributes

The limit of length has been discussed in a previous question linked by Mary Melody above: Is there a limit to the length of HTML attributes?

like image 175
Iain Avatar answered Oct 06 '22 22:10

Iain