HTML Quotations 💬

beginner
14 min

HTML Quotations 💬

Welcome to our comprehensive guide on using HTML to create quotations! In this lesson, we'll explore various ways to format and style quotations in your web pages, making your content more engaging and readable. 🎯

Let's get started!

The <q> Tag 📝

The <q> tag is used to define a short inline quotation within the text.

html
<p>The cat said, "<q>I'm hungry!</q>"</p>

Results in:

The cat said, "I'm hungry!"

Browser Support 📝

The <q> tag is supported by all modern browsers.

Quiz

Quick Quiz
Question 1 of 1

Which HTML tag is used for a short inline quotation within the text?

The <blockquote> Tag 📝

The <blockquote> tag is used to define a longer quotation, or a quotation that stands alone.

html
<blockquote> <p>And remember, no matter where you go, there you are. 🎯</p> </blockquote>

Results in:

And remember, no matter where you go, there you are.

Browser Support 📝

The <blockquote> tag is supported by all modern browsers.

Nesting <blockquote> Tags 📝

You can nest <blockquote> tags to represent nested quotations.

html
<blockquote> <p>He said, "<blockquote>And remember, no matter where you go, there you are.</blockquote>"</p> </blockquote>

Results in:

He said:

And remember, no matter where you go, there you are.

Quiz

Quick Quiz
Question 1 of 1

Which HTML tag is used for a longer quotation, or a quotation that stands alone?

Quotation Attributes 📝

The <q> and <blockquote> tags both support the cite attribute to provide a reference to the source of the quotation.

html
<blockquote cite="https://www.goodreads.com/quotes/571506-and-remember-no-matter-where-you-go-there-you-are"> <p>And remember, no matter where you go, there you are.</p> </blockquote>

Results in:

And remember, no matter where you go, there you are.

(Source: https://www.goodreads.com/quotes/571506-and-remember-no-matter-where-you-go-there-you-are)

Quiz

Quick Quiz
Question 1 of 1

Which attribute is used to provide a reference to the source of the quotation in HTML?

Styling Quotations 💡

While HTML provides basic styling for quotations, you can also use CSS to create custom styles.

css
blockquote { border-left: 5px solid #ccc; padding: 10px; margin-left: 20px; }

Quiz

Quick Quiz
Question 1 of 1

How can you use CSS to create custom styles for quotations?

Conclusion ✅

Now that you've learned about HTML quotations, you can make your web content more engaging by effectively using the <q> and <blockquote> tags. Remember to cite your sources and consider adding custom styles to make your quotations stand out. Happy coding! 🎉