Skip to content
Tutorials Center
My learning

Topics

Lesson 10 of 122 Β· Text Content

Quotations, Citations and Abbreviations

Quote and credit other people's words with blockquote, q and cite, explain abbreviations and terms with abbr and dfn, and handle contact details and text direction.

Writing on the web often means borrowing words: a line from a speech, a passage from a book, a customer's review. It also means using shorthand like "CSS" and introducing new terms. HTML has a group of elements that make these things explicit, so browsers, screen readers and search engines know which words are quoted, which are titles and what an abbreviation stands for.

This lesson covers quotations (<blockquote>, <q>), titles of works (<cite>), abbreviations and definitions (<abbr>, <dfn>), contact information (<address>) and two elements for mixing languages that run in different directions (<bdi>, <bdo>).

Long quotations: <blockquote>

Use <blockquote> for a quotation that stands on its own as a block β€” usually one or more paragraphs taken from somewhere else. Browsers indent it on both sides by default.

The optional cite attribute holds the URL of the source. Browsers do not display it; it is there for software and for anyone reading the code. The visible credit β€” who said it, and where β€” goes outside the <blockquote>, because it is not part of the quoted words. A neat way to keep the quotation and its credit together is a <figure> with a <figcaption>:

A block quotation with a credit

Notice that the quoted text sits inside its own <p>. A <blockquote> is a container, so it can hold paragraphs, lists or even headings from the original. You will see <figure> again in Figures and Captions.

Do not use <blockquote> just to indent text. That was a common trick in the 1990s. Screen readers announce a blockquote as a quotation, so using it for layout misleads people. Indent with CSS instead.

Short, inline quotations: <q>

For a quotation inside a sentence, use <q>. You do not type the quotation marks yourself β€” the browser adds them, and it chooses the right style for the language set with lang. Quotes inside quotes get the secondary style automatically.

Inline quotes in different languages

English gets curly double quotes outside and single quotes inside; German and French get their own conventions. Like <blockquote>, <q> accepts a cite attribute with a source URL.

Use <q> only for real quotations. For sarcastic "scare quotes" or for a word you are talking about, just type the quotation marks.

Titles of works: <cite>

<cite> marks the title of a creative work: a book, film, song, painting, game, article, website, TV show, research paper and so on. Browsers show it in italics.

HTML
<p>My favorite chapter of <cite>The Voyage Home</cite> is the storm.</p>
<p>We watched <cite>Tides of Glass</cite> twice last weekend.</p>

A common mistake is to wrap a person's name in <cite>. In HTML, a name is not a title, so it does not belong in <cite>. In the first example above, the name "Mara Quinlan" is plain text, and only the book title is cited.

Do not confuse the <cite> element (a visible title) with the cite attribute on <blockquote>, <q>, <ins> and <del> (a hidden source URL).

Abbreviations: <abbr>

<abbr> marks an abbreviation or acronym. Add a title attribute with the full expansion, and many browsers show it as a tooltip when you hover:

HTML
<p>
  Most pages are delivered over
  <abbr title="Hypertext Transfer Protocol Secure">HTTPS</abbr>.
</p>

A tooltip is not available on touch screens or to keyboard users, though. The most accessible approach is to spell the term out in the text the first time you use it, and use <abbr> to connect the two:

HTML
<p>
  The World Health Organization (<abbr>WHO</abbr>) published new guidance.
  Later, the <abbr title="World Health Organization">WHO</abbr> updated it.
</p>

Definitions: <dfn>

<dfn> marks the defining instance of a term β€” the place where you explain what a word means. The paragraph (or section, or list item) around it should contain the definition.

abbr and dfn

Giving each <dfn> an id lets you link back to the definition from anywhere on the page β€” handy in long articles. When the term is an abbreviation, put an <abbr> inside the <dfn>, as in the second paragraph. For a whole glossary of terms, a description list is usually better; see Description Lists.

Contact information: <address>

The name <address> is misleading. It is not for any postal address on a page. It holds contact information for the people or organization responsible for the nearest <article>, or for the whole page when it is not inside an article. Typical contents are an author's name with a link, an email address or a phone number:

HTML
<footer>
  <address>
    Questions about this guide? Write to
    <a href="mailto:[email protected]">the editor</a>
    or call <a href="tel:+15550100">+1 555 0100</a>.
  </address>
</footer>

A shop's address in a list of store locations is just content β€” use a paragraph with <br> line breaks, as you did in Headings and Paragraphs. You will learn more about mailto: and tel: links in Email, Phone and Download Links.

Text direction: dir, <bdi> and <bdo>

Some languages, such as Arabic and Hebrew, are written right to left (RTL). For a whole page in one of these languages, set the direction on the root element:

HTML
<html lang="ar" dir="rtl">

Mixing directions inside one line is harder. Browsers use the Unicode bidirectional algorithm to work out the order of characters, and punctuation or numbers next to RTL text can end up in surprising places. This often happens with text you do not control, such as usernames.

<bdi> (bidirectional isolate) fixes this. It isolates its content so its direction cannot leak into the surrounding text. Compare the two lists below:

Isolating user names with bdi

In the first list, the Arabic name pulls the colon and the number into its right-to-left run, so the line appears jumbled. In the second, each name is isolated and every line reads correctly. Whenever you insert text whose direction you do not know β€” names, titles, search terms β€” wrap it in <bdi>. The global attribute dir="auto" does the same job on other elements.

<bdo> (bidirectional override) is the opposite: it forces a direction, ignoring the normal rules. It requires a dir attribute:

HTML
<p>This text is <bdo dir="rtl">backwards</bdo>.</p>

You will rarely need <bdo>; it is mainly for special cases such as displaying text stored in the wrong order.

Check your understanding

Quick check Β· 4 questions

of 4 answered You scored / 4 Β· perfect!

  1. 1. Where should the name of the person you are quoting go?

    The blockquote should contain only the quoted words. The credit goes outside it, and a figure with a figcaption keeps the two together.
  2. 2. Which markup is correct for: Read Moby-Dick by Herman Melville?

    <cite> marks the title of a work. A person's name is not a title, so it stays outside.
  3. 3. Why should you not type quotation marks inside a <q> element?

    Browsers insert quotation marks around <q> based on the language, so typing them too would give you double marks.
  4. 4. A forum shows usernames that may be in any language. What prevents a right-to-left name from jumbling the text next to it?

    <bdi> isolates text of unknown direction. <bdo> forces a direction, which would display RTL names backwards.

Summary

  • <blockquote> holds a block quotation; <q> holds an inline one and the browser adds the quotation marks.
  • The cite attribute is a hidden source URL; the <cite> element marks a visible title of a work, never a person's name.
  • <abbr> marks abbreviations; spell the term out in text the first time and use title as a bonus.
  • <dfn> marks the place where a term is defined.
  • <address> is contact information for the page or article, not any postal address.
  • Use dir="rtl" for right-to-left pages, <bdi> to isolate text of unknown direction, and <bdo> only to force a direction.

Next: Code, Keyboard Input and Program Output β€” marking up the language of computers.