XML technologies / CSS / CSS Cookbook / Typography for the web / Styling a pull quote with HTML text

(Excerpt from “CSS Kochbuch” by Christopher Schmitt)

Problem

You want to style a pull quote—literally, an attention-grabbing quotation—so that it differs from the default appearance. Without highlighting, quotations are not immediately recognizable as another author’s words (see the next figure), whereas appropriately emphasized quotations are easy to recognize (see the figure after that).

Default pull quote text appearance

Figure: Default pull quote text appearance.

The pull quote with custom styles

Figure: The pull quote with custom styles.

Solution

Use the element blockquote to mark a pull quote as a quotation in the document structure:

<blockquote>
  <p>Ma quande lingues coalesce, li grammatica del resultant lingue es plu simplic e regulari quam ti del coalescent lingues.</p>
  <div class="source">John Smith at the movies</div>
</blockquote>

Now use CSS to assign the element blockquote padding, margins and color:

blockquote {
 margin: 0;
 padding: 0;
 color: #555;
}

Then define styles for the blockquote element’s p and div elements:

blockquote p {
 font: italic 1em Georgia, Times, "Times New Roman", serif;
 font-size: 1em;
 margin: 1.5em 2em 0 1.5em;
 padding: 0;
}
blockquote .source {
 text-align: right;
 font-style: normal;
 margin-right: 2em;
}

Discussion

Pull quotes attract readers’ attention so that they keep reading your text. A simple way to create them is to change text color. Increase contrast further by changing the generic font family: for example, if the rest of the document uses a sans-serif font, use a serif font for the pull quote.

See also

The recipe Bordered pull quotes and the recipe Pull quotes with images for more information on styling pull quotes with CSS.

  

 

 

 

back to top