HTML Quotations
In HTML, you can use the <q>
tag for short inline quotations and the <blockquote>
tag for longer block quotations.
Inline Quotations
To create an inline quotation, use the <q>
tag with the text inside the tag:
<p>I love HTML programming. My favorite quote is <q>Code is poetry</q>.</p>
When the above code is rendered in a browser, it will display as:
I love HTML programming. My favorite quote is Code is poetry
.
Block Quotations
To create a block quotation, use the <blockquote>
tag with the text inside the tag:
<blockquote>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Curabitur vehicula lectus auctor justo blandit gravida.
Proin euismod libero eget nunc facilisis, id accumsan massa ultricies.
In hac habitasse platea dictumst.</p>
<p>- John Doe</p>
</blockquote>
When the above code is rendered in a browser, it will display as:
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur vehicula lectus auctor justo blandit gravida. Proin euismod libero eget nunc facilisis, id accumsan massa ultricies. In hac habitasse platea dictumst.
- John Doe
Attribution in Block Quotations
You can include attribution in block quotations as shown in the previous example. This helps in crediting the source of the quote.
Summary
In this tutorial, you learned how to use inline and block quotations in HTML using the <q>
and <blockquote>
tags respectively. Quotations add emphasis to certain text and can be used to credit sources in block quotations.
Tag | Description |
---|---|
<q> |
Used for inline quotations |
<blockquote> |
Used for block quotations |