HTML Elements Showcase - Inline vs Block

In HTML, elements are broadly divided into two categories: block-level and inline. Block elements take up the full width and always start on a new line, while inline elements only take as much space as needed and sit within a line of text.

[Block Elements] [Inline Elements] [Comparison]

Block Elements

1. <div>

This is inside a <div>

Div is a block container used to group content.

2. <p>

This is a paragraph example.

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

3. <h1>-<h6>

Heading 1

Heading 2

Heading 3

Heading 4

Heading 5
Heading 6

Headings are block-level elements that take the full width.

4. <ul> and <ol>

  1. Ordered item 1
  2. Ordered item 2

Lists are block-level containers for items.

5. <blockquote>

“Coding is the new literacy.”

Blockquote is a block container for quotations.

6. <hr>

Before horizontal line


After horizontal line

<hr> draws a thematic break.

7. <table>

Col 1Col 2
AB

Table is a block-level structure for tabular data.

8. <section>

This is a section block.

Section groups content into thematic blocks.

9. <article>

Article Title

This is an independent article block.

Article represents independent content.

10. <nav>

Nav defines a block of navigation links.

Inline Elements

1. <span>

This is highlighted with span inside text.

Span is an inline container with no new line.

2. <a>

Visit Example site.

Anchor creates hyperlinks and stays inline.

3. <b>

This word is bold inside a sentence.

B makes text bold but with no semantic meaning.

4. <i>

This word is italic inline.

I makes text italic for style.

5. <u>

This is underlined text.

U tag adds underline inline.

6. <strong>

Warning: Do not share password.

Strong represents strong importance.

7. <em>

This word is emphasized.

Em adds emphasis, usually italics.

8. <sup> and <sub>

E = mc2 and H2O.

Sup shows superscript, sub shows subscript.

9. <mark>

This is highlighted text.

Mark highlights text inline.

10. <abbr>

HTML is a markup language.

Abbr defines an abbreviation with a tooltip.

11. <code>

Use console.log("Hello") in JavaScript.

Code represents inline code snippets.

Inline vs Block Comparison

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]