Learn the various text tags that make writing richer and more meaningful.
1. Emphasis Tags
strong - Strong Emphasis (Semantic Importance)
<p>You must take this medicine <strong>3 times a day</strong>.</p>
<p><strong>Warning:</strong> This information is very important.</p>
- Browsers display it in bold.
- It is not just about looking bold; it carries the meaning that the content is important.
- Screen readers (tools for people with visual impairments) read it with emphasis.
em - Emphasis (Intonation, Stress)
<p>I am <em>really</em> hungry.</p>
<p>That is not something <em>I</em> did.</p>
- Browsers display it in italic.
- It means giving a specific word the stress of spoken intonation.
b and i - Visual Presentation (No Meaning)
<p>This is <b>bold text</b>, but it has no particularly important meaning.</p>
<p>This is <i>italic text</i>, but it carries no meaning of emphasis.</p>
| Tag | Visual Effect | Semantic Importance |
|---|---|---|
<strong> |
Bold | Yes (important content) |
<b> |
Bold | No (styling only) |
<em> |
Italic | Yes (stress/emphasis) |
<i> |
Italic | No (technical terms, foreign words, etc.) |
Recommendation: Where possible, use
<strong>and<em>rather than<b>and<i>.
Writing meaningful HTML is better for SEO and accessibility.
2. Quotation Tags
blockquote - Block Quotation
Represents a long quotation taken from another source. It is a block-level element.
<blockquote cite="https://www.example.com">
<p>
"Education is not the filling of a pail, but the lighting of a fire."
</p>
</blockquote>
citeattribute: specifies the URL of the quotation's source (not visible on screen)- Browsers display it with indentation.
cite - Title of a Work / Source
Represents the title of a creative work such as a book, movie, or song.
<p>
<cite>Harry Potter and the Sorcerer's Stone</cite> is a novel written by J.K. Rowling.
</p>
<blockquote>
<p>"And yet it moves."</p>
<footer>— <cite>Galileo Galilei</cite></footer>
</blockquote>
q - Inline Quotation
Used when a short quotation appears inside a sentence.
<p>The teacher said, <q>if you work hard, you will surely succeed</q>.</p>
- Browsers automatically add quotation marks (
" ").
3. Code-Related Tags
code - Inline Code
<p>When declaring a variable, use <code>let</code> or <code>const</code>.</p>
<p>In HTML, a paragraph uses the <code><p></code> tag.</p>
- Mainly used to express a single line of code, such as a tag name, function name, or variable name.
- Browsers display it in a monospace font.
pre - Preformatted Text Block
<pre>
function greet(name) {
console.log("Hello, " + name + "!");
}
greet("John Doe");
</pre>
- Spaces and line breaks are preserved exactly as entered.
- It is usually used together with
<code>to represent a block of code.
<pre><code>
def hello():
print("Hello, World!")
hello()
</code></pre>
4. Line Breaks and Dividers
br - Line Break
<p>
123 Teheran-ro<br>
Gangnam-gu, Seoul<br>
Suite 401, 4th Floor
</p>
- It is an empty tag with no closing tag.
- Used when you need a simple line break rather than a new paragraph.
- Avoid overuse: Using
<br>several times to create space between paragraphs is not a good idea. Use CSS instead.
hr - Horizontal Rule (Topic Separation)
<p>This is the content of the first section.</p>
<hr>
<p>This is the content of the second section. The hr tag above visually separates the two sections.</p>
- Indicates a change of topic or a separation between paragraphs.
- It is an empty tag.
5. Superscript and Subscript
sup - Superscript
<p>The chemical formula for water is H<sub>2</sub>O, and carbon dioxide is CO<sub>2</sub>.</p>
<p>Pythagorean theorem: a<sup>2</sup> + b<sup>2</sup> = c<sup>2</sup></p>
<p>It is also used to mark a footnote reference<sup>1</sup>.</p>
sub - Subscript
<p>Molecular formula of water: H<sub>2</sub>O</p>
<p>Glucose: C<sub>6</sub>H<sub>12</sub>O<sub>6</sub></p>
6. Other Useful Tags
mark - Highlighter Effect
<p>The exam covers <mark>chapters 3 through 5</mark>.</p>
del - Deleted Text
<p>Price: <del>$50.00</del> → $35.00 (special discount)</p>
ins - Inserted Text
<p>Meeting date: changed from <del>March 5</del> to <ins>March 7</ins>.</p>
abbr - Abbreviation
<p><abbr title="HyperText Markup Language">HTML</abbr> is the foundational language of the web.</p>
- Write the full form of the abbreviation in the
titleattribute. - It is shown as a tooltip when the mouse hovers over it.
Summary
| Tag | Description | Block/Inline |
|---|---|---|
<strong> |
Emphasizes important content (bold) | Inline |
<em> |
Emphasizes stress (italic) | Inline |
<b> |
Bold (no meaning) | Inline |
<i> |
Italic (no meaning) | Inline |
<blockquote> |
Block quotation | Block |
<q> |
Inline quotation | Inline |
<cite> |
Title of a work/source | Inline |
<code> |
Inline code | Inline |
<pre> |
Text block with preserved formatting | Block |
<br> |
Line break | Inline |
<hr> |
Horizontal rule/topic separation | Block |
<sup> |
Superscript | Inline |
<sub> |
Subscript | Inline |
<mark> |
Highlighter emphasis | Inline |
<del> |
Deleted text | Inline |
<ins> |
Inserted text | Inline |
<abbr> |
Abbreviation | Inline |
Next Steps
- View the Example - a blog post format example
- Check the Assignment - create a book/movie review page
- Next lesson: Links and Images