• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint

Quoting Text

There are two special tags for marking quoted text so that you can identify its author, origin, and language. Block-level quotes are generally indented by browsers. Inline quotes are supposed to be automatically enclosed in quotation marks and thus, you should not include them in the text.

To quote block-level text

Type <blockquote to begin a block-level quote.

If desired, type cite=“url”, where url is the address of the source of the quote.

Type > to complete the opening tag.

Type the text that you wish to appear set off from the preceding and following text, including any necessary HTML tags.

Type </blockquote> to complete the element.

To quote inline text

Type <q to begin.

If desired, type xml:lang=“xx” lang=“xx”, where xx is the two-letter code for the language the quote will be in. This code is supposed to determine the type of quote marks that will be used (“” for English, «» for many European languages, etc.).

Type > to complete the opening tag.

Type the text that should be quoted.

Type </q>.

If desired, in the html tag, add xml:lang=“xx” lang=“xx”, where xx is the two-letter code for the language that most of your Web page is in.

Figure 4.12. A block quote can be as short or as long as you need. You can even divide it into various paragraphs by adding p tags as necessary.

<p>Sometimes I get to the point where I'm not sure
anything matters at all. Then I read something like
this and I am inspired: </p>

<blockquote cite="http://www.kingsolver.com">

<p>It's not hard to figure out what's good for kids,
but amid the noise of an increasingly antichild
political climate, it can be hard to remember just to
go ahead and do it: for example, to vote to raise
your school district's budget, even though you'll pay
higher taxes. (If you're earning enough to pay taxes
at all, I promise, the school needs those few bucks
more than you do.) To support legislators who care
more about afterschool programs, affordable
health care, and libraries than about military
budgets and the Dow Jones industrial average. To
volunteer time and skills at your neighborhood
school and also the school across town. To decide to
notice, rather than ignore it, when a neighbor is
losing it with her kids, and offer to babysit twice a
week. This is not interference. Getting between a
ball player and a ball is interference. The ball is


<p>This is from Barbara Kingsolver's brilliant
collection of essays, <cite>High Tide in
Tucson</cite> (1995, HarperCollins)</p>.


Figure 4.13. Block quotes are generally indented from both sides. The cite attribute is not yet supported by any browser I’ve seen.

Figure 4.14. The lang attribute in the html tag is supposed to be a default for the other tags. In my tests, it does serve as a default, but can’t quite be overridden.

<html xmlns="http://www.w3.org/1999/xhtml"


<p>And then she said <q>Have you read
Kingsolver's <q> High Tide in Tucson </q>? It's

<p>She tried again, this time in French: <q
						lang="fr">Avez-vous lu le livre <q lang="fr">High
Tide in Tucson</q> de Kingsolver? C'est

Figure 4.15. If you specify “en” for the lang attribute in the html element, Explorer for Mac uses curly quotes. Note how the inner quotes are single in the English quote, but all of the quotes are double in the French quote.

Figure 4.16. This time, we use “fr” for the lang attribute in the html tag. (And please, pardon my French!)

<html xmlns="http://www.w3.org/1999/xhtml"


<p>And then she said <q lang="en">Have you
read Kingsolver's <q lang="en">High Tide in
Tucson</q>? It's inspiring.</q></p>

<p>Grasping at straws, she gave it one last shot,
this time in French:<q>Avez-vous lu le livre
<q>High Tide in Tucson </q> de Kingsolver? C'est

Figure 4.17. Now we’ve got those cute guillemet quotes around everything except nested quotes—which might be OK if the document is all French.


  • Text and inline elements should not be placed directly between the opening and closing blockquote tags. Instead, enclose the text and inline elements in a blocklevel tag—like p, for example—within the blockquote tags.

  • You can nest both blockquote and q elements. Nested q elements should automatically have the appropriate quotation marks—in English the outer quotes should be double and the inner ones should be single.

  • Proper support for q varies widely from one browser to the next. Explorer 5 for Mac is best, using curly quotes and nesting them properly, and even using guillemets («») for French (as long as you set the lang attribute in the html tag). Netscape 6 Mac/Win uses straight double quotes for everything except nested q elements, where it uses single straight quotes. Opera 5 Mac/Win uses straight double quotes for everything, including nested q elements. Explorer for Windows (up to and including version 6) ignores the q element completely.

  • The cite attribute may also be used with the q element, although it makes less sense. I haven’t seen a browser that does anything with it in either element.

  • For more details on the xml:lang and lang attributes, consult Specifying Your Page’s Language on page 342.

  • You can find a complete list of language codes at http://www.w3.org/WAI/ER/IG/ert/iso639.htm.

  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint