html
  1. html-q-tag

HTML <q> Tag

  • The <q> tag in HTML is used to define short quotations.
  • The content inside the <q> tag is typically enclosed in quotation marks.

Syntax

The basic syntax of the <q> tag is:

<q>Quoted text</q>

Example

Suppose you want to quote the saying by Mahatma Gandhi, "Be the change you wish to see in the world". You can use the <q> tag to do this as follows:

<p>"<q>Be the change you wish to see in the world</q>" - Mahatma Gandhi</p>
Try Playground

Explanation

The <q> tag is an inline element in HTML. It only applies to short quotations that are part of a surrounding paragraph of text.

The <q> tag can be nested inside other HTML elements like <p>, <div>, or <blockquote>.

Use

The <q> tag is used to indicate a short quotation. It is typically used in the body of an article or blog post where you want to mention a quote in the text.

Important Points

Here are some important points to keep in mind while using the <q> tag:

  • The <q> tag is not used for long quotes or block quotes. For that, you should use the <blockquote> tag.
  • If you want to emphasize the text inside the <q> tag, you can use the <em> or <i> tags to add emphasis.
  • The <q> tag is available in HTML5 and is not supported in earlier versions of HTML.

Summary

The <q> tag is a useful way to quote small snippets of text in your web pages. It is a simple and lightweight tag that is easy to use. Remember to use the <blockquote> tag for longer quotes.

Published on: