NANDHOO.

Entities, Structured Data, and HTML5 Browser APIs

Entities, Structured Data, and HTML5 Browser APIs


This chapter collects several important HTML5 extras that improve content clarity, discoverability, and browser-powered features.


HTML Entities


Entities let you display reserved or special characters safely.


Examples:


  • &lt; for <
  • &gt; for >
  • &amp; for &
  • &quot; for "
  • &copy; for ©

Example:


<p>Use &lt;section&gt; for grouped content.</p>

Structured Data


Structured data helps machines understand what your content represents.


Microdata Attributes


  • itemscope
  • itemtype
  • itemprop
  • itemid
  • itemref

Example:


<article itemscope itemtype="https://schema.org/Article">
    <h1 itemprop="headline">Learning HTML5</h1>
    <p itemprop="author">Sam Lee</p>
</article>

HTML5 Browser APIs Often Used with HTML


Local Storage


Purpose:


  • saves simple key-value data in the browser

Geolocation


Purpose:


  • can request the user's location with permission

Drag and Drop


Purpose:


  • supports dragging interface items between targets

History API


Purpose:


  • lets apps update browser history during navigation

These APIs are mostly controlled with JavaScript, but HTML often provides the elements and attributes they connect to.