Understanding 12 Categories of HTML DOM Elements

Vikesh Mittal
6 min readJun 8, 2024

--

In this article, I’ll delve into an alternative perspective on mastering different DOM elements, categorized by their unique attributes. Join me as we embark on a comprehensive journey through the world of Document Object Model (DOM) elements, those fundamental building blocks that underpin the structure and functionality of web pages. From the humble <div> to the versatile <input>, each element plays a crucial role in shaping the user experience and driving interaction on the modern web.

Note: This article is NOT to learn too much about individual DOM element in detail as that will become replication of already available libraries like ‘MDN Web Docs’ or ‘W3 Schools’.

What is DOM?

The Document Object Model, commonly referred to as DOM, is a programming interface for web documents. It represents the structure of HTML and XML documents as a tree-like model where each node represents a part of the document, such as elements, attributes, and text.

DOM provides a way for programs to dynamically access and manipulate the content, structure, and style of web documents. This allows developers to create interactive and dynamic web pages by scripting languages like JavaScript to interact with the DOM and modify elements, update content, respond to user actions, and more.

HTML (Hypertext Markup Language) and DOM (Document Object Model) are closely related but serve different purposes in web development. HTML is a markup language used to create the structure and content of web pages. It defines the elements that make up a web page. On the other hand, the DOM is a programming interface that represents the structure of HTML and XML documents as a tree-like model.

1. HTML Document Structure Elements

These elements define the overall structure of an HTML document. They set up the basic framework that other elements fit into, ensuring the document is correctly parsed and displayed by browsers.

<html>:  The root element that encloses all other elements.
<head>: Contains meta-information about the document, such as its title and links to stylesheets.
<title>: Specifies the document's title, shown in the browser's title bar or tab.
<base>: Sets a base URL for all relative URLs in the document.
<link>: Defines relationships between the current document and external resources.
<meta>: Provides metadata such as descriptions, keywords, and character sets.
<style>: Contains internal CSS styles.
<body>: Encloses the content that is visible on the web page.

2. Content Sectioning Elements

These elements are used to create distinct sections of content, aiding both in layout and accessibility. They help in defining the logical structure of the document.

<header>:  Represents introductory content or a set of navigational links.
<nav>: Defines a section containing navigation links.
<section>: Groups related content into thematic sections.
<article>: Specifies independent, self-contained content.
<aside>: Contains content tangentially related to the main content, such as sidebars.
<footer>: Defines a footer for a document or section.
<address>: Provides contact information for the author of the document or article.
<main>: Represents the main content of the document.

3. Text Content Elements

These elements are used for organizing and formatting blocks of text within a document. They provide structure to textual content, making it easier to read and understand.

<h1> to <h6>: Define hierarchical headings from the most important (`h1`) to the least important (`h6`).
<p>: Represents a paragraph of text.
<hr>: Creates a thematic break or horizontal rule.
<pre>: Displays preformatted text, preserving whitespace and line breaks.
<blockquote>: Indicates a section that is quoted from another source.
<ol>, <ul>, <li>: Create ordered (numbered) and unordered (bulleted) lists.
<dl>, <dt>, <dd>: Define description lists with terms (`dt`) and descriptions (`dd`).
<figure>: Encapsulates media and their captions.
<figcaption>: Provides a caption for the content in a 'figure'.
<div>: A generic container for grouping content.

4. Inline Text Semantics

These elements are used within text blocks to apply specific styles or denote certain types of text without breaking the flow of content.

<a>:     Defines a hyperlink.
<em>, <strong>: Indicate emphasis and strong importance, respectively.
<small>: Reduces the font size of the text.
<s>: Represents text that is no longer accurate or relevant.
<cite>: Indicates a reference to a creative work.
<q>: Denotes short, inline quotations.
<abbr>: Represents an abbreviation or acronym.
<data>: Associates a machine-readable value with its contents.
<time>: Represents dates and times.
<code>: Displays code snippets.
<var>: Indicates variables in programming or mathematical expressions.
<kbd>: Represents user input.
<sub>, <sup>: Define subscript and superscript text.
<i>, <b>: Italicize and bold text for stylistic purposes.
<u>: Underlines text.
<mark>: Highlights text.
<bdi>: Isolates text for bidirectional text formatting.
<bdo>: Overrides the current text direction.
<span>: A generic inline container.
<br>: Inserts a line break.
<wbr>: Suggests a line break opportunity.

5. Image and Multimedia

These elements handle the inclusion and formatting of images, videos, and other multimedia content. It enables the integration of visual and multimedia content into web pages.

<img>:     Embeds an image.
<iframe>: Embeds another HTML page within the current page.
<embed>: Embeds external content, such as multimedia.
<object>: Represents an external resource, typically multimedia.
<param>: Defines parameters for `object`.
<video>: Embeds a video player.
<audio>: Embeds an audio player.
<source>: Specifies multiple media resources for media elements (`video` and `audio`).
<track>: Defines text tracks for media elements.
<map>: Defines an image map with clickable areas.
<area>: Specifies the clickable areas within an image map.
<picture>: Provides multiple `source` elements for different image resolutions.

6. Embedded Content

These elements are used to embed content from external sources or to define templates and scripts.

<iframe>:  Embeds another HTML page.
<embed>: Integrates an external application or multimedia content.
<object>: Represents an external resource.
<param>: Provides parameters for an `object`.
<video>: Embeds a video.
<audio>: Embeds an audio file.
<source>: Specifies multiple media sources.
<track>: Adds text tracks to media.
<map>: Defines an image map.
<area>: Specifies the clickable regions in an image map.
<picture>: Defines a picture element with multiple sources.
<portal>: Represents a placeholder for an external document.

7. Scripting

These elements are related to scripting languages, primarily JavaScript, and are used to embed or link scripts and define templates.

<script>:   Embeds or references executable code.
<noscript>: Defines alternative content for users with disabled scripts.
<template>: Holds client-side content that won't be rendered when the page loads.
<canvas>: Provides a drawable region for graphics via scripting.

8. Demarcating Edits

These elements are used to indicate changes or edits in the document, such as insertions and deletions.

<ins>: Represents text that has been inserted.
<del>: Represents text that has been deleted.

9. Table Content

These elements are used to create and manage tabular data, allowing for structured data presentation.

<table>:    Defines a table.
<caption>: Provides a table caption.
<colgroup>: Groups columns in a table.
<col>: Specifies column properties.
<tbody>, <thead>, <tfoot>: Define groups of rows within a table.
<tr>: Defines a table row.
<td>: Defines a table cell.
<th>: Defines a table header cell.

10. Forms

These elements are used to create forms for user input, which can then be submitted to a server for processing.

<form>:     Defines an HTML form.
<label>: Labels a form control.
<input>: Represents a variety of input controls.
<button>: Represents a clickable button.
<select>: Creates a drop-down list.
<datalist>: Provides a list of predefined options for an input.
<optgroup>: Groups options within a `select` element.
<option>: Defines an option in a `select` element.
<textarea>: Defines a multi-line text input control.
<output>: Represents the result of a calculation or user action.
<progress>: Represents the completion progress of a task.
<meter>: Represents a scalar measurement within a known range.
<fieldset>: Groups related form controls.
<legend>: Provides a caption for a `fieldset`.

11. Interactive Elements

These elements are used to create interactive user interfaces, enhancing user experience through interactive controls.

<details>: Creates a disclosure widget that users can open and close.
<summary>: Provides a summary for the `details` element.
<dialog>: Defines a dialog box or window.

12. Web Components

These elements allow developers to create custom, reusable HTML tags to encapsulate functionality.

<slot>: Defines a placeholder within a web component's shadow DOM where external content can be dynamically inserted.
<template>: Allows developers to define reusable markup templates within a web component, which can be instantiated multiple times without being rendered until explicitly activated.

--

--

Vikesh Mittal
Vikesh Mittal

Written by Vikesh Mittal

User Interface Architect | Passionate about Micro-frontends | Angular | React | https://vikeshmittal.com/

No responses yet