Understanding HTML Elements and Its Types: A Complete Beginner's Guide

calender-iconPublished: 11 May 2025

clock-icon5-min read




INTRODUCTION

HTML elements are the building blocks of web pages. Every HTML webpage consists of different types of elements. These elements can be used to define metadata, text, scripts, media and others content in webpage. The basic structure of an HTML element consists of opening tag, attributes, content and closing tag, which is shown in the figure below.

HTML Element Basic Structure
Opening Tag

It consists of tag name enclosed in opening and closing angle brackets (<>). This tag marks the Beginning of element.

Content

This section consists of element's content. It can be text, image and others depending on element type.

Closing Tag

This tag is same as opening tag, with the only difference being the element name is preceded by forward slash (/). This tag marks the end of element. Not every element has closing tag.

Attributes

An attribute defines the characteristic and functionality of element. They provide an extra bit of information about the element.


HTML element can be classified into two types depending on content. They are classified as Replaced and Non-replaced element.

  • Replaced Element
  • Non-replaced Element


Replaced Element

Replaced elements are those whose content comes from an external source and replaced in webpage. As the content is defined outside of the webpage it is outside the scope of CSS, i.e. their content is not affected by CSS formatting model. The position of replaced element can be defined using CSS but not the content. They often have natural dimensions.

Replaced elements can be replaced by UI widget with controls or image depending on element type. Every browser applies some default style according to element type. Below is a list of replaced elements.

  • <applet>
  • <audio>
  • <br>
  • <button>
  • <canvas>
  • <embed>
  • <iframe>
  • <img>
  • <input>
  • <math>
  • <object>
  • <select>
  • <svg>
  • <textarea>
  • <video>
Void Element

Void Element are those elements that cannot have any content. They cannot have child elements (nested element or text content). They are self-closing element and are represented by one tag; i.e. they only have start tag and end tags should not be specified. You can include a slash at the end of tag which is optional.

Replaced elements and void elements are generally confused and used interchangeably. Most replaced element are void elements but not each one of them. For example, Elements like <video>, <iframe> and <picture> are replaced but not void element.

Also, most void elements are replaced but not all. For example, Elements like <base>, <link> and <meta> are void but not replaced element. The void element is HTML are as follows.

  • <area>
  • <base>
  • <br>
  • <col>
  • <embed>
  • <hr>
  • <img>
  • <input>
  • <link>
  • <meta>
  • <source>
  • <track>
  • <wbr>
Non-Replaced Element

Non-Replaced elements are those whose content is inside the element. The element's content is not replaced. They have both opening and closing tag. They can also sub-nest other elements. The browser process that content normally according to CSS Model.

Below is a list of non-replaced elements (list non exhaustive).

  • <p>
  • <ul>
  • <ol>
  • <h1> -- <h6>
  • <div>

Block And Inline Element

HTML element can be classified into two types depending on their default display behaviour in the browser.

  • Block Element
  • Inline Element
block-vs-inline
Block Element

Block elements take up the full width available of container (even if its content is small). They are displayed as block and placed one after another vertically similar to paragraphs in text.

Block elements always start on a new line. They can contain other block and inline elements. They are used to structure the webpage — like paragraphs, sections, headers, etc.

Below is a list of Block Level elements.

  • <address>
  • <article>
  • <aside>
  • <blockquote>
  • <canvas>
  • <dd>
  • <dl>
  • <dt>
  • <div>
  • <fieldset>
  • <figcaption>
  • <figure>
  • <footer>
  • <form>
  • <h1>
  • <h2>
  • <h3>
  • <h4>
  • <h5>
  • <h6>
  • <header>
  • <hr>
  • <li>
  • <main>
  • <nav>
  • <noscript>
  • <ol>
  • <p>
  • <pre>
  • <section>
  • <table>
  • <ul>
  • <video>
Inline Element

Inline Element Does not start on a new line, it stays in the flow of text. These elements Flows alongside other elements horizontally. They only take up as much width as its content needs. They cannot contain block-level elements (only text or other inline elements).

Below is a list of Inline elements.

  • <abbr>
  • <acronym>
  • <b>
  • <bdo>
  • <br>
  • <button>
  • <cite>
  • <code>
  • <dfn>
  • <em>
  • <i>
  • <img>
  • <input>
  • <kbd>
  • <label>
  • <map>
  • <mark>
  • <object>
  • <output>
  • <q>
  • <samp>
  • <script>
  • <select>
  • <span>
  • <sub>
  • <sup>
  • <small>
  • <textarea>
  • <time>
  • <var>

Frequently Asked Questions (FAQ)

What is the difference between an HTML elements and tags?
The terms HTML elements and HTML tags are often used interchangeably, but they have distinct meanings in the context of HTML. Tags are the markup components used in HTML code to define the start and end of an element. They are written within angle brackets (< and >) and typically come in pairs: an opening tag and a closing tag.

An element is the complete unit in an HTML document, consisting of the opening tag, the content (if any), and the closing tag (if applicable).

Why is using semantic HTML elements important?
Using semantic HTML elements is important because they provide meaningful structure to web content, improving accessibility, search engine optimization (SEO), maintainability, and interoperability. Semantic elements (e.g., <article>, <nav>, <header>, <footer>, <aside>) describe the purpose or role of the content they contain, unlike non-semantic elements (e.g., <div>, <span>) which are generic and lack inherent meaning.

What is the difference between block and inline HTML elements?
Block elements Takes up the full width available of container (even if its content is small). Block elements always start on a new line. They can contain other block elements and inline elements.

Inline Element Does not start on a new line; it stays in the flow of text. These elements Flows alongside other elements horizontally. They only take up as much width as its content needs. They cannot contain block-level elements (only text or other inline elements).

How many html elements are there?
As of April 2025, the HTML Living Standard maintained by the WHATWG (Web Hypertext Application Technology Working Group) defines 112 HTML elements in the HTML5 specification. Below is the complete list of all elements grouped by their primary function.

Metadata Content (7): <base>, <link>, <meta>, <noscript>, <script>, <style>, <title>

Sectioning Content (9): <article>, <aside>, <main>, <nav>, <section>, <header>, <footer>, <body>, <hgroup>

Heading Content (6): <h1>, <h2>, <h3>, <h4>, <h5>, <h6>

Grouping Content (14): <blockquote>, <dd>, <div>, <dl>, <dt>, <figcaption>, <figure>, <hr>, <li>, <menu>, <ol>, <p>, <pre>, <ul>

Phrasing Content (32): <a>, <abbr>, <address>, <b>, <bdi>, <bdo>, <br>, <cite>, <code>, <data>, <dfn>, <del>, <em>, <i>,<ins>, <kbd>, <mark>, <q>, <rp>, <rt>, <ruby>, <s>, <samp>, <small>, <span>, <strong>, <sub>, <sup>, <time>, <u>, <var>, <wbr>,

Embedded Content (13): <area>, <audio>, <canvas>, <embed>, <iframe>, <img>, <map>, <object>, <param>, <picture>, <source>, <track>, <video>

Form-associated Content (14): <button>, <datalist>, <fieldset>, <form>, <input>, <label>, <legend>, <meter>, <optgroup>, <option>, <output>, <progress>, <select>, <textarea>

Interactive Content (3): <details>, <dialog>, <summary>

Tabular Content (8): <caption>, <col>, <colgroup>, <table>, <tbody>, <td>, <tfoot>, <th>, <thead>, <tr>

Scripting and Miscellaneous (6): <html>, <head>, <template>, <slot>, <search>, <svg>,

What html elements are focusable?
By default, these elements are focusable:
<input>, <select>, <textarea>, <button>, <a>, <details>, <summary>, <iframe>

Conditionally focusable:
<div>, <span>, <section>, <article>, <p>, <img>, <svg>

Non-focusable by default:
<p>, <ul>, <li>, <div>, <span>, <fieldset>, <legend>

Do all HTML tags come in pair?
No, not all HTML tags come in pairs. While many HTML elements have both opening and closing tags (called container tags), some are self-closing or void elements, meaning they don’t have a closing tag because they don't contain any content. The void elements are listed below
  • <area>
  • <base>
  • <br>
  • <col>
  • <embed>
  • <hr>
  • <img>
  • <input>
  • <link>
  • <meta>
  • <source>
  • <track>
  • <wbr>

Are HTML tags case-sensitive?
No, HTML tags are not case-sensitive in standard HTML5.