Saturday, December 2, 2023
HomeVideo EditingHTML Aspect: knowledge

HTML Aspect: knowledge


The HTML <knowledge> aspect represents machine-readable knowledge. This aspect offers metadata for computer systems, corresponding to knowledge for engines like google or different processing instruments.

You should use the <knowledge> tag with scripts on an internet web page when a script has a literal worth to retailer alongside a human-readable worth. The format used relies upon solely on the wants of the script.

Syntax

1
<knowledge worth="worth">knowledge</knowledge>

The worth attribute specifies the worth of the info. The content material of the <knowledge> aspect is the human-readable model of the info.

Examples

Right here’s a primary instance of the <knowledge> aspect.

1
<p>The overall income for Q1 2021 was $<knowledge worth="50000">50,000</knowledge>.</p>

Right here’s one other instance utilizing JavaScript; it fetches the present Bitcoin worth in $USD and shows the up to date worth with every web page refresh.

Syntax

1
<div class="container">
2
  <p>The present worth of Bitcoin is: <knowledge id="bitcoin-price"></knowledge> USD</p>
3
</div>

End result

Attributes

The <knowledge> aspect helps World Attributes in HTML. World Attributes are widespread to all HTML components and can be utilized on all of them (although they could not have a lot impact on some).

The <knowledge> aspect particularly helps the next attribute:


  • worth: Specifies the worth of the info.

Content material

The <knowledge> aspect can include any textual content that gives a human-readable model of the info. This content material is non-compulsory, as the info will be specified fully by means of the worth attribute.

Did You Know?

  • The <knowledge> aspect is usually used with CSS to cover machine-readable knowledge from human customers whereas making it accessible to machines.
  • The <knowledge> aspect is much like the <meta> aspect, which offers metadata concerning the HTML doc.

Be taught Extra

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments