HTML Elements Showcase – Inline vs Block

Introduction: In HTML, elements are broadly divided into two categories: block-level and inline. Block elements take up the full width, while inline elements only take as much space as needed.

Block Elements
Inline Elements
Comparison

Block Elements

Example:

This is a paragraph

Explanation: The <p> tag defines a block of text that always starts on a new line. Example:

This is a heading

Explanation: Headings are block-level elements that take the full width. Example:
"Coding is the new literacy."
Explanation: Blockquote is a block container for quotations.

Inline Elements

Example: This is inside a spanExplanation: Span is an inline container with no new line. Example: HTML stands for HTML. Explanation: Abbr defines an abbreviation. Example: E = mc2 Explanation: Superscript is inline and sits above text. Example: console.log("Hello World") Explanation: Code tag represents programming text.

Comparison Table

Differences Between Inline and Block Elements
Block Elements Inline Elements
<div> <span>
<p> <a>
<h1> <b>
<ul> <i>
<blockquote> <abbr>
<table> <code>
<hr> <sup>
<section> <mark>

Back to Top