Rafael Camargo

HTML elements you might not know

Since I created a component library called Taslonic, I have been discovering how native HTML is more powerful than I imagined. How versatile it is. How harmonious is its integration to the operating system of any device. In brief words, how much this technology, often underestimated, can leverage our productivity by saving us from writing hundreds of lines of code.

See below some native HTML elements which you might not have been introduced to yet.

Details

It disclosures additional information or form controls.

Transaction details
Descriptions:
Lifetime license | Typenik
Date:
Apr 29, 2023
Price:
$9
<details>
  <summary>Transaction details</summary>
  <dl>
    <dt>Descriptions:</dt>
    <dd>
      Lifetime license | 
      <a href="https://typenik.compilorama.com/" rel="noreferrer noopener" target="_blank">
        Typenik
      </a>
    </dd>
    <dt>Date:</dt> <dd>Apr 29, 2023</dd>
    <dt>Price:</dt> <dd>$9</dd>
  </dl>
</details>

Edit this code. Docs for Details.

Browser Support
Source: caniuse.com
BrowserSinceVersion
ChromeJun, 6 201169
FirefoxSep, 19 2016110
SafariJul, 24 201212.1
EdgeJan, 14 202079

Dialog

It is a temporary component of an application which users interact with to carry out a specific task or obtain information. When the user is finished, the dialog box can either be automatically closed by the application or manually closed by the user.

Native HTML Dialog

<button onclick="nativeDialog.showModal()">
  Open Dialog
</button>
<dialog id="nativeDialog">
  <p>Native HTML Dialog</p>
  <form method="dialog">
    <button type="submit">Dismiss</button>
  </form>
</dialog>

Edit this code. Docs for Dialog.

Browser Support
Source: caniuse.com
BrowserSinceVersion
ChromeAug, 25 201437
FirefoxMar, 7 202298
SafariMar, 13 202215.4
EdgeJan, 14 202079

Math

It is used to express mathematical notations and is filled with a set of especific elements specified by the MathML (Mathematical Markup Language).

x=-b±b2-4ac2a
<math>
  <mi>x</mi>
  <mo>=</mo>
  <mfrac>
    <mrow>
      <mo>-</mo>
      <mi>b</mi>
      <mo>±</mo>
      <msqrt>
        <msup>
          <mrow>
            <mi>b</mi>
          </mrow>
          <mn>2</mn>
        </msup>
        <mo>-</mo>
        <mi>4</mi>
        <mi>a</mi>
        <mi>c</mi>
      </msqrt>
    </mrow>
    <mrow>
      <mi>2</mi>
      <mi>a</mi>
    </mrow>
  </mfrac>
</math>

Edit this code. Docs for Math.

Browser Support
Source: developer.mozilla.org
BrowserSinceVersion
ChromeJan, 10 2023109
FirefoxMar, 22 20114
SafariJul, 20 20115.1
EdgeJan, 12 2023109

Meter

It represents the current measure within a known range. For example, storage usage, statistical confidence interval, performance, among other cases.

at 50/100
<label for="fuel">Fuel level</label>
<meter
  id="fuel"
  min="0"
  max="100"
  low="10"
  high="80"
  optimum="85"
  value="50"
>
  at 50/100
</meter>

Edit this code. Docs for Meter.

Browser Support
Source: caniuse.com
BrowserSinceVersion
ChromeDez, 1 20108
FirefoxAug, 27 201216
SafariJul, 24 20126
EdgeNov, 11 201513

Progress

It represents the completion progress of a task.

70%
<label for="reviewedArticles">
  Reviewed articles
</label>
<progress
  id="reviewedArticles"
  min="0"
  max="100"
  value="70"
>
  70%
</progress>

Edit this code. Docs for Progress.

Browser Support
Source: caniuse.com
BrowserSinceVersion
ChromeDez, 1 20108
FirefoxAug, 15 20116
SafariJul, 24 20126
EdgeJul, 28 201512

HTML is an involving technology, evolves rapidly and, above all, it has shown me that may be already available some component I'd start to implement from scratch.