Technical writing services by Espirian

Anatomy of an HTML page – part 4

In this post:

Many people will be familiar with the common HTML elements used to write headings and paragraphs. But what about displaying quotations?

Let’s start by looking at blockquotes.


In HTML, the <blockquote> element is used to set content (often just text) apart from the copy above and below. This gives us a good way to display quotations and other notes.

Here’s an example of the <blockquote> element:

<p>This is a normal paragraph.</p>
<!-- Note the default indentation of the blockquote when viewed in the browser  -->
<p>This text has been placed into a blockquote element to show what happens when using one of the most basic quoting features in HTML. All web browsers handle blockquotes slightly differently, but the general behaviour is pretty much the same across the board.</p>

This is how the code looks in the browser:

A normal paragraph followed by a blockquote

Quotation marks are not automatically added to the content. This is consistent with the treatment of most ‘displayed’ material in print.

The default style is for a generous left indent to be applied to the content within the blockquote, thus clearly setting it apart from any content above and below.

It’s not good form to use the <blockquote> element only to move content across the page.

Such changes are better handled by Cascading Style Sheets (CSS), which allow us to apply margins and padding. As I’ve mentioned before, we’ll discuss CSS in a future post.

Citing a source

As anyone who works in the editorial field will know, it’s important to include a source whenever quoting someone else. So far as HTML goes, though, this isn’t essential: blockquotes do not require a citation.

If you wish to include a citation, the correct method is to use the <cite> element. This appears inside the <blockquote> element, as shown here:

<p>Be a yardstick of quality. Some people aren't used to an environment where excellence is expected.</p>
<a href="">Steve Jobs</a>

It makes sense to include not only the name of the person being quoted but also a source on the web (if there is one), so I’ve placed a hyperlink to the quote in the <cite> element. The hyperlink is added by using the <a> (for ‘anchor’) element with an href="" attribute.

Here’s the result in the browser:

Blockquote with a source

My browser’s default styling is to italicise text within the <cite> element.

Inline quotations

To include a quotation in running text, we usually place quotation marks around the content to be quoted and then follow it with the source in brackets.

A quick digression on notes

In print, it’s common to use numbered cues to point to footnotes (at the bottom of the page) or endnotes (at the end of a chapter or book). This approach isn’t best suited to the web.

The good news is that hyperlinks allow us to point directly to sources on the web.

Now, back to inline quotations. HTML has its own <q> element specifically for this sort of construction. Here it is:

<p>I agree with Carl Sagan's take on this: <q>Absence of evidence is not evidence of absence.</q></p>

Here’s the result in the web browser:

As you can see, the quote marks appear in place of the start and end of the <q> element. It may seem academic to use this element when you could just as well write the quote marks directly into the HTML, but there can be styling and semantic reasons for retaining the use of the <q> element.

Here’s what the HTML 5.1 specification has to say about the use of the <q> element:

The q element must not be used in place of quotation marks that do not represent quotes; for example, it is inappropriate to use the q element for marking up sarcastic statements.

The use of q elements to mark up quotations is entirely optional; using explicit quotation punctuation without q elements is just as correct.

I’ve also used this example to show off my own style of blockquotes. And to see a slightly fancier set of blockquotes, look at what I’ve done on my Testimonials page.

The result

As with previous parts in the series, I’ve rolled up the information in this part and placed it at the bottom of an HTML file that you can download and inspect here: sample4.html.

End of part 4

Next time, we’ll change tack as we look at the <head> section of our HTML pages.

As usual, I’m interested to know what you think of the content, so please leave a comment below or drop me a line on Twitter (@espirian). For other ways to get in touch, take a look at my Contact page.

Read the whole HTML series

Subscribe for tips

🍩 No spam or the doughnuts are on me • privacy

Join 515 others on my free Espresso ☕️ email list to receive:

  • blog updates
  • free ebooks
  • discounts on consultancy
  • offers and secret stuff

Who wrote this?

I'm John Espirian, the relentlessly helpful technical copywriter. I've written about IT and the web since 1998, and I'm a former Microsoft MVP. If you need B2B web content that explains how your products, services and processes work, I'm your guy.

The Espirian blog provides writing tips and how-to guides on improving your online presence and marketing your business.

Status: naively optimistic about Liverpool's 2019 title challenge 🔴⚽️