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 use as much width as their content needs.
[Block Elements] [Inline Elements] [Comparison]
Example: <div>This is a div container</div>
Explanation: The div is a block container used for grouping content.
Example: <p>This is a paragraph</p>
Explanation: The paragraph always starts on a new line.
Explanation: Headings (h1–h6) are block elements taking full width.
Explanation: Headings define document structure and hierarchy.
Explanation: <ul> creates an unordered list.
Explanation: <ol> creates an ordered (numbered) list.
"Coding is the new literacy."
Explanation: <blockquote> is for long quotations, block-level.
Explanation: <hr> adds a horizontal line separator.
| Row 1, Col 1 | Row 1, Col 2 |
| Row 2, Col 1 | Row 2, Col 2 |
Explanation: <table> is a block element used for tabular data.
This is inside a section element.
Explanation: <section> groups thematic content, block-level.
Example: This is inside a span
Explanation: Span is inline, no new line.
Example: Visit this link
Explanation: <a> is inline, used for hyperlinks.
Example: Bold text and italic text
Explanation: <b> and <i> are inline text styling.
Example: Underlined text
Explanation: <u> is inline underline.
Example: Strong text and emphasized text
Explanation: <strong> and <em> are semantic inline emphasis.
Example: E = mc2
Explanation: <sup> is superscript (inline).
Example: H2O
Explanation: <sub> is subscript (inline).
Example: Highlighted word
Explanation: <mark> highlights text, inline.
Example: HTML
Explanation: <abbr> shows abbreviation/tooltip.
Example: console.log("Hello World");
Explanation: <code> represents inline programming code.
| Block Elements | Inline Elements |
|---|---|
| <div> | <span> |
| <p> | <a> |
| <h1> | <b> |
| <ul> | <i> |
| <blockquote> | <abbr> |
| <table> | <code> |
| <hr> | <sup> |
| <section> | <mark> |