Citations

format_quote The <q> Element

The HTML <q> element indicates that the enclosed text is a short inline quotation.

Most modern browsers implement this by surrounding the text in quotation marks.

code Syntax

<q cite="https://example.com/source">Quoted text here</q>

The optional cite attribute provides a URL that designates the source document or message.

Note: The URL is not shown by the browser by default.

visibility Browser Display

How it appears:
HAL answers: I'm sorry, Dave. I'm afraid I can't do that.

Browsers automatically add quotation marks around the content.

format_list_bulleted Code Examples

<p>When Dave asks HAL to open the pod bay door, HAL answers: <q>I'm sorry, Dave. I'm afraid I can't do that</q>.</p>
<p>According to Mozilla's website, <q cite="https://developer.mozilla.org">Firefox 1.0 was released in 2004</q>.</p>

lightbulb Best Practices

  • check_circle Use for short quotations that don't require paragraph breaks
  • check_circle For long quotations, use the <blockquote> element
  • check_circle Always include the cite attribute when possible
  • check_circle Improves semantic meaning and accessibility

assignment Exercise: Inline Quotations

Create a web page with code examples and add your own quotations from movies or books.

HTML cite attribute example