HTML Tutorial

HTML Tag: <q>

Usage of <q>:

The <q> tag represents an inline quotation. It is typically used for short quotes within a paragraph.

Attributes of <q>:

  • cite: Specifies the URL of the source document containing the quoted text.

Examples with <q>:

  • To display a simple quote: <q>This is a quote.</q>
  • To display a quote with a citation: <q cite="https://example.com">This quote is from an external source.</q>

Simple HTML Example to Explore the <q> Tag:

<!DOCTYPE html>
<html>
<head>
  <title>Exploring the `<q>` Tag</title>
</head>
<body>
  <h1>Exploring the `<q>` Tag</h1>
  <p>This paragraph contains a quote from a famous book:</p>
  <q>The greatest glory in living lies not in never falling, but in rising every time we fall. - Nelson Mandela</q>
</body>
</html>

Tips for Improving Accessibility and Ease of Use:

  • Use screen reader-friendly text alternatives (e.g., alt tags for images).
  • Ensure the quoted text is easy to distinguish from the surrounding content.
  • Consider using blockquotes for longer quotes to improve readability.