HTML provides specific tags to define quotations. These tags help to semantically represent quoted text, making it easier for browsers and other user agents to render and interpret the content correctly. The main tags for quotations in HTML are blockquote, q, and cite.
The <blockquote> tag is used for long quotations that are displayed as a block. This tag typically indents the quoted section from the rest of the content.
Tag | Description | Example |
---|---|---|
<blockquote> | Defines a block quotation. |
Try yourself
|
The <q> tag is used for shorter quotations that are included inline with the surrounding text. Browsers typically enclose the text in quotation marks.
Tag | Description | Example |
---|---|---|
<q> | Defines an inline quotation. |
Try yourself
|
The <cite> tag is used to define the title of a work, such as a book, a report, a website, or a piece of creative work.
Tag | Description | Example |
---|---|---|
<cite> | Defines the title of a work. |
Try yourself
|
Here is an example that demonstrates how to use various HTML quotation tags:
Example: Combining Blockquote, Q, and Cite Tags
<blockquote cite="https://www.goodreads.com/quotes">
"The only limit to our realization of tomorrow is our doubts of today."
<cite>Franklin D. Roosevelt</cite>
</blockquote>
<p>Another example of an inline quote: <q>Do not go where the path may lead, go instead where there is no path and leave a trail.</q> - <cite>Ralph Waldo Emerson</cite></p>
This example shows how to use the <blockquote>, <q>, and <cite> tags together to create a rich quotation experience.
Here are some important notes and best practices when using HTML quotation tags:
HTML quotation tags provide a way to semantically represent quoted text on web pages. By using the <blockquote>, <q>, and <cite> tags appropriately, you can enhance the readability and credibility of your content.