TheDeveloperBlog.com

Home | Contact Us

C-Sharp | Java | Python | Swift | GO | WPF | Ruby | Scala | F# | JavaScript | SQL | PHP | Angular | HTML

HTML data tag

HTML data tag with examples, html5, forms, input, text, anchor, image, heading, marquee, textarea, paragraph, title, quotes, code etc.

<< Back to HTML

HTML Data Tag

The HTML <data> tag is used to provide a machine readable version of its own contents. It displays the data in a special format. It is useful in the case where your data needs to be in a certain format because it may be processed by a script, but this might not be the format that you'd like your users to see.

Let's take a scenario to understand it well:

Suppose you have to represent some numbers to your users with letter (i.e. one, two, three and so on) but you have script that sorts the numbers in ascending or descending orders. So your script needs numbers in a format like 1, 2, 3... etc.

The <data> tag is here to solve your problem.

For the users: Write within the <data>....</data> tag.

For the script: Use value attribute.

<data value="1">One </data>

HTML data tag attribute

There is only one required attribute. The data tag supports global and event attributes also.

AttributeDescription
valueIt is required attribute. It is used to provide the machine-readable version of tag's content.

HTML data tag example

<ul>
<li><data value="101">Java Tutorial</data></li>
<li><data value="111">SQL tutorial</data></li>
<li><data value="121">HTML tutorial</data></li>
</ul>
Test it Now

Output:

  • Java Tutorial
  • SQL tutorial
  • HTML tutorial

Supporting Browsers

Elementchrome browser Chromeie browser IEfirefox browser Firefoxopera browser Operasafari browser Safari
<data>YesYesYesYesYes
Next TopicHTML datalist tag




Related Links:


Related Links

Adjectives Ado Ai Android Angular Antonyms Apache Articles Asp Autocad Automata Aws Azure Basic Binary Bitcoin Blockchain C Cassandra Change Coa Computer Control Cpp Create Creating C-Sharp Cyber Daa Data Dbms Deletion Devops Difference Discrete Es6 Ethical Examples Features Firebase Flutter Fs Git Go Hbase History Hive Hiveql How Html Idioms Insertion Installing Ios Java Joomla Js Kafka Kali Laravel Logical Machine Matlab Matrix Mongodb Mysql One Opencv Oracle Ordering Os Pandas Php Pig Pl Postgresql Powershell Prepositions Program Python React Ruby Scala Selecting Selenium Sentence Seo Sharepoint Software Spellings Spotting Spring Sql Sqlite Sqoop Svn Swift Synonyms Talend Testng Types Uml Unity Vbnet Verbal Webdriver What Wpf