HTML Quotations, citations and Comments

HTML Basics: HTML Quotations, Citations and Comments

HTML Quotations, Citations and Comments.

Here, we are discussing HTML Quotations, Citations and Comments. blockquotes, inline quotes and citation are parts of Quotation in HTML.

Sing-line line comments and multi-line comments are parts of Comments in HTML.

We have already discussed about HTML paragraph, Style and Formatting.

HTML Quotations

The <blockquote> and <q> elements are frequently used in HTML to manage quotations. Here’s a quick rundown on how to apply them:

Blockquotes

Use the<blockquote> element for lengthy quotations that are often presented as blocks.

<blockquote>
  This is a block quote. It's used for longer quotations that should stand out from the main text.
</blockquote>

Inline quotes

The <q> element is used for shorter inline quotations that are a component of a longer statement.

<p>She said, <q>This is an inline quote.</q> And continued with her story.</p>

Citation

To indicate the quotation’s original source, a citation attribute can be included in either the <blockquote> or<q> element.

<blockquote cite="https://www.example.com">
  This is a block quote with a citation.
</blockquote>

<p>She said, <q cite="https://www.example.com">This is an inline quote with a citation.</q> And continued with her story.</p>

Example

Here’s an example of how you might use both types of quotations in an HTML document:

See the Pen
Untitled
by Meena Subash (@Meena-Subash-the-sasster)
on CodePen.

HTML Comments

Comments in HTML are used to add notes or explanations to the HTML code that won’t show up on the page. Developers can use this to temporarily hide parts of the code or to leave reminders. The following is the syntax for HTML comments:

<!-- This is a comment -->

Single-line comment

Without removing the code, you can use comments to temporarily disable it.

<!-- <p>This paragraph will not be displayed on the webpage.</p> -->
<p>This paragraph is visible on the webpage.</p>

In First line is removed from the webpage , without deleting it.

Multi-line Comments

If needed, comments can span several lines.

<!--
  This is a multi-line comment.
  It spans multiple lines.
-->
<p>This paragraph is visible on the webpage.</p>

In this example, we removed two lines.

Example

See the Pen
HTML Comments
by Meena Subash (@Meena-Subash-the-sasster)
on CodePen.

In this example, the comments provide explanations for different parts of the code and temporarily hide an unordered list.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top