Wednesday, 1 November 2017

Custom Data Attributes in HTML5

Custom Data Attribute is the new features of HTML5 is the addition of custom Data Attributes. A custom Data attribute is used to store private data which is not seen by end users of the application. A custom Data attribute consists of the below two parts:


  1. Attribute name- Specifies a name that must be prefixed with data- and does not contain any uppercase letters. 
  2. Attribute value- Specifies a value in string format. 
FOR EXAMPLE :

<LI class="user" data-name="AjuSingh" data-city ="delhi" data-lang="js" data-food="pizza">
<B>Akumar says:</B>
<SPAN>Hello dear, how are you? </SPAN>
</LI>


Here data-name, data-city, data-lang, and data-food are examples of the custom attributes. 

No comments:

Post a Comment