Custom Attributes in HTML5

A new feature being introduced in HTML 5 is the addition of custom data attributes.

A custom data attribute starts with data- and would be named based on your requirement.

Custom Attributes
<div class=”sample” data-subject=”chemistry” data-mark=”10″>

</ div>

The above will be perfectly valid HTML5 with two custom attributes called data-subject and data-mark. We should be able to get the values of these attributes using JavaScript APIs or CSS in similar way as we get for standard attributes.