skip to content rich footer

stevenclark.com.au

subscibe to the StevenClark.com.au rss feed

Correct Use of Blockquote and Q

One of the most maligned elements in the (X)HTML arsenal is the blockquote. Used properly it enables us to mark up longer quotations. Used for bad, its infamy is as a grimy slug sucking way to indent parts of a layout. My sin has been more along the lines of laziness via software authoring. Let me explain.

I have to admit that in the last year or so I’ve only really used blockquote via WordPress. Most project work I do is now handled by content management software of some sort and I’ve been predominantly using WordPress – which happens to insert the <p> tags into the blockquote automagically. So, what I’m used to writing in blog posts is: – WRONG.

<blockquote cite="the_url_of_origin">This is something I happen to be quoting<cite>Person Quoted</cite></blockquote>

This is actually invalid XHTML 1.0 Strict. What WordPress rightly does, it inserts <p> (paragraph) block level elements around the content of my quotation within the blockquote tags. CORRECT.

<blockquote cite="the_url_of_origin"><p>This is something I happen to be quoting<cite>Person Quoted</cite></p></blockquote>

Roger Johansson’s Use Only Block-Level Elements in Blockquotes explains that only block level elements can be direct descendents of a blockquote. Which explains why it would be just as invalid to have the <cite> element outside the <p> element. This would be as follows – WRONG.

<blockquote cite="the_url_of_origin"><p>This is something I happen to be quoting</p><cite>Person Quoted</cite></blockquote>

Also, you will note in these examples you can use the cite attribute within the blockquote to identify the source of the quoted material. Admittedly this isn’t that useful (as far as I’m aware) except to assist anyone looking at the code. You could provide an unobtrusive script which takes cite attributes and places them in your markup, its always an option.

And, don’t forget the humble <q> element for inline quotes that aren’t very long. It’s often overlooked. An example follows:

<p>As <cite>Bill Jones</cite> said on the radio <q>That was one for the Gipper</q> before he fell over stone cold dead!</p>

I hope this improves your understanding of these elements. If I’ve been wrong in the past on my use of blockquote syntax it’s simply a by-product of content management software picking up after me. Are you getting to be a lazy coder, too?

Comments are closed.

Social Networking

Keep an eye out for me on Twitter

About the Author

Steven Clark Steven Clark - the stand up guy on this site

My name is Steven Clark (aka nortypig) and my passions are business, web development, photography and writing. My current CV [PDF 775KB] is available for download. Currently I'm completing my 2 final units of a post-graduate university degree of MBA (Journalism and Media Studies) at the University of Tasmania.

Photography

My fine art photography is available online at Steven Clark Studio. You may also enjoy my photo blog Walk a Mile in my Shoes.

Recently Reviewed Books

Site Supporters

Hosted by Brett Drinkwater at Tashosting who is always there at the other end of my every inconvenient question and technical crisis. Brett's local community support for us over the last five years is greatly appreciated.

skip to top of page

Currently Reading

Light Science and Magic by Hunter, Biver and Fuqua - cover

The time has come for me to get more involved in upping my technical photography skills if I hope to embark on a Master of Fine Art and Design (Photography) next year. To that end my first book is the highly recommended Light Science & Magic: An Introduction to Photographic Lighting (Third Edition) by Fil Hunter, Steven Biver and Paul Fuqua. What really differentiates this book is the comprehensive set of exercises and the detailed explanation of the underlying science of light in the real world that encompasses the reader's journey.