In HTML, elements are generally divided into two types: Block elements and Inline elements. Block ones usually start on a new line and take full width, while inline elements sit inside a line and only take space they need.
Block Elements | Inline Elements | Comparison
Div is a generic block element, often used as a container.
This is a paragraph text.
Paragraph tag always starts on a new line.
Headings (h1 to h6) are block elements for titles.
ul = unordered list
ol = ordered list
"Coding is the new literacy."
blockquote is used for quotations.
hr creates a horizontal line.
A1 | A2 |
B1 | B2 |
table makes rows and columns.
Some section content here...
section is used for grouping related content.
This word is inside span in a sentence.
span is inline container.
Go to Example site.
a tag is a hyperlink.
This is bold text.
b makes text bold (no extra meaning).
This is italic text.
i makes text italic.
This is underlined text.
u makes text underlined.
This is strong text.
strong means important text.
This is emphasized text.
em tag gives emphasis.
E = mc2
sup is for superscript.
H2O
sub is for subscript.
This is highlighted text.
mark highlights text.
We call HTML as markup language.
abbr defines abbreviations.
Code example: console.log("Hello")
code shows inline programming text.
Block Elements | Inline Elements |
---|---|
<div> | <span> |
<p> | <a> |
<h1>–<h6> | <b> |
<ul> | <i> |
<blockquote> | <abbr> |
<table> | <code> |
<hr> | <sup> |
<section> | <mark> |