HTML <blockquote> Tag β Block Quotes
π Introduction
The <blockquote> tag is used to display a large quotation from another source or text.
It is typically used for:
- Quotes in articles or blogs
- Highlighting important statements
- Referencing external content
Browsers usually indent the content inside <blockquote>.
π§± Syntax
<blockquote>Your quote here</blockquote>
π‘ Example
<!DOCTYPE html>
<html>
<head>
<title>Blockquote Example</title>
</head>
<body>
<h1>Famous Quote</h1>
<blockquote>
The best way to learn HTML is by practicing every day.
</blockquote>
</body>
</html>
π₯οΈ Output Explanation
- The text inside
<blockquote>appears indented - It is visually separated from normal text
- Helps highlight important content
π― When to Use <blockquote>
Use it for:
- Quotes from books or people
- Testimonials
- Highlighted statements
- Blog citations
Example:
<blockquote>
"Code is like humor. When you have to explain it, itβs bad."
</blockquote>
π‘ Optional Attribute: cite
You can add a source using cite:
<blockquote cite="https://example.com">
Learning HTML is easy with practice.
</blockquote>
β Helps indicate where the quote comes from β Useful for SEO and documentation
β‘ <blockquote> vs <q>
| Tag | Use |
|---|---|
<blockquote> |
Long quotes (block-level) |
<q> |
Short inline quotes |
Example:
<p>He said: <q>Hello world</q></p>
π« Common Mistakes
- Using
<blockquote>just for indentation β - Using it for normal text β
- Forgetting it is for quotes, not layout β
π¨ Styling <blockquote>
You can customize it:
<blockquote style="border-left: 4px solid gray; padding-left: 10px;">
This is a styled quote.
</blockquote>
π§ͺ Mini Exercise
Create a page with:
- A heading
- A paragraph
- A
<blockquote>containing a motivational quote
π Try styling it with a left border