Introduction to HTML Quotes
HTML offers a simple and effective way to add quotations to your web pages. By using the <blockquote> and <q> tags, you can easily include quotations and cite the source in your HTML documents.
The <blockquote> Tag
The <blockquote> tag is used to indicate that the enclosed text is a lengthy quotation. It is a block-level element and is commonly styled by web browsers with an indentation.
The <q> Tag
The <q> tag is used for shorter, inline quotations within a paragraph. Browsers typically surround the content in double quotation marks.
Using the cite Attribute
Both the <blockquote> and <q> tags support the cite attribute, which can be used to provide the source or reference for the quotation. It is a good practice to include the cite attribute to properly cite the origin of the quote.
Example Code
<p>Here is a quote using the <blockquote> tag:</p> <blockquote cite="https://www.example.com/quote1">This is a lengthy quotation.</blockquote> <p>Here is a quote using the <q> tag:</p> <p>This is an inline <q cite="https://www.example.com/quote2">quotation</q> within a sentence.</p>