HTML data attributes are a great way to add custom data to an element. However, there are certain rules for the names of these attributes, and the use of capital letters is not permitted.
For example, if you try to create a data attribute such as data-slidesPerView
, this violates HTML rules. Instead, it must be written in all lowercase. In other words, it is properly data-slidesperview
.
This is due to the HTML specification, which requires that attribute names be in ASCII lowercase only. If this rule is violated, the browser may not recognize the attribute name correctly.
Therefore, when using data attributes, keep in mind that attribute names should be written in lowercase only.