Master HTML From Scratch

Clear, interactive, and structured HTML lessons designed for beginners.

HTML Quotations

Learn how to represent short quotations, long quotations, and quoted titles or references using HTML elements.

Introduction to HTML Quotations

HTML provides specific elements for marking quoted content. These elements help communicate the structure and meaning of quotation content.

Common Quotation Elements:
<q> - short inline quotation
<blockquote> - longer quotation
<cite> - title or reference to a creative work

The <q> Element

The <q> element is used for a short inline quotation.

Syntax

<q>Quoted text</q>

Example

<p>
    The instructor said
    <q>Practice HTML every day.</q>
</p>

Output

The instructor said Practice HTML every day.

The <blockquote> Element

The <blockquote> element is used for longer quotations that are separated from the surrounding content.

Syntax

<blockquote>
    Quoted content goes here.
</blockquote>

Example

<blockquote>
    Learning to write programs expands
    your ability to solve problems.
</blockquote>

Output

Learning to write programs expands your ability to solve problems.

<q> vs <blockquote>

Element Purpose Typical Usage
<q> Represents a short inline quotation. A sentence or short phrase inside a paragraph.
<blockquote> Represents a longer quotation. A separate quotation block.

The <cite> Element

The <cite> element is used to identify the title of a creative work or a reference to a source.

<p>
    I am reading
    <cite>The Web Development Guide</cite>.
</p>

I am reading The Web Development Guide.

Using <blockquote> with <cite>

<blockquote>

    Learning is a continuous process.

    <cite>
        Web Development Guide
    </cite>

</blockquote>
Learning is a continuous process.
Web Development Guide

The cite Attribute

The cite attribute can provide a URL that identifies the source of quoted information.

<blockquote cite="https://example.com/source">

    Quoted information goes here.

</blockquote>
Important: The cite attribute identifies the source programmatically; it does not automatically display the source URL to the user.

Short Quotation Examples

Example 1
<p>
    She said
    <q>Learn HTML first.</q>
</p>
Example 2
<p>
    The teacher said
    <q>Practice regularly.</q>
</p>

Long Quotation Example

<blockquote>

    HTML provides the structure of a web page.
    CSS controls its visual presentation.
    JavaScript can add interaction and behavior.

</blockquote>
HTML provides the structure of a web page. CSS controls its visual presentation. JavaScript can add interaction and behavior.

Quotations Inside Paragraphs

<p>

    Our instructor said
    <q>HTML is the foundation of web development.</q>

    We followed the advice.

</p>

Our instructor said HTML is the foundation of web development. We followed the advice.

Styling Quotations with CSS

CSS can be used to control the appearance of quotation blocks without changing their semantic meaning.

<blockquote class="custom-quote">
    Learn something new every day.
</blockquote>

<style>

    .custom-quote {
        border-left: 4px solid blue;
        padding-left: 15px;
        font-style: italic;
    }

</style>
Learn something new every day.

Example 🤓🌍

<h2>
    Student Feedback
</h2>

<blockquote>

    The HTML course helped me understand
    the fundamentals of web development.

    <cite>
        Student Feedback
    </cite>

</blockquote>

<p>

    The instructor said
    <q>Practice by building projects.</q>

</p>

Student Feedback

The HTML course helped me understand the fundamentals of web development.
Student Feedback

The instructor said Practice by building projects.

Important Points

  • Use <q> for short inline quotations.
  • Use <blockquote> for longer quotations.
  • Use <cite> for the title of a creative work or source reference.
  • The cite attribute can identify the source of quoted information.
  • Use CSS when you need to change the visual appearance of quotation elements.

Common Mistakes

  • Using <blockquote> for every short sentence.
  • Using quotation elements only for visual indentation.
  • Forgetting to identify the source when the source information is available.
  • Using quotation tags where normal text formatting would be more appropriate.

Practice Exercise

  1. Create a short quotation using <q>.
  2. Create a long quotation using <blockquote>.
  3. Add a source title using <cite>.
  4. Add a cite attribute to a blockquote.
  5. Use CSS to style your blockquote.

Summary

HTML provides quotation elements to give quoted content appropriate structure and meaning. Use <q> for short inline quotations, <blockquote> for longer quotations, and <cite> for titles or references to creative works. CSS can be used to style quotation elements without changing their semantic purpose.