Using a decorative initial capital letter to start a paragraph is a very old technique, pre-dating the invention of movable type. Some of the most beautiful and ornate initial capitals are associated with illuminated manuscripts, largely written by clergy between the 4th and 15th centuries CE.
Initial capitals have an important editorial role to play: they indicate to the reader that a new section of text has begun. Initial caps are typically several times larger than the base font used on the page, and are featured only once per text section: in a traditional book, once per chapter; in a website, perhaps once per page. They are commonly associated with leading, opening, or first paragraphs.
An oversized initial capital letter that shares a common baseline with the first line of text is known as a standing initial capital, standing cap, or pop cap. An initial capital letter that has several lines of text to its right is known as a dropped initial capital, or drop cap.
Simple Standing Cap
First, our code:
<h1>The First Phillipic</h1>
<p>Philip, after the defeat of Onomarchus, had marched toward the pass of Thermopylae, which, however, he found occupied by the Athenians, who had sent a force for the purpose of preventing his advance. Being baffled there, he directed his march into Thrace, and alarmed the Athenians for the safety of their dominions in the Chersonese.
The matching CSS:
h1 + p:first-letter {
font-size: 300%;
}
Note that an initial cap is typically changed in appearance in greater ways than we have done here: color
, font
(a sans-serif typeface is often used) and other properties are often altered.
Simple drop cap
Turning the initial cap into a drop cap could not be simpler:
h1 + p:first-letter {
font-size: 300%;
float: left;
}
Note that any element can be floated, not just images. We would typically add margin
, padding
and other properties to this declaration in order to improve the appearance of the drop cap. Unfortunately, the browser will not attempt to align the baseline of the drop cap to the nearest matching text line; that will be up to us.
Image-based drop cap
A truly ornate standing or drop cap, like the illuminated example that led this entry, would not be text, but an image. In that case, the id
and existing style would be removed, to make way for HTML code. If our image was called p.jpg, then our HTML code would be:
<p><img src="p.jpg" alt="P" style="float: left;">hilip,
after the defeat of Onomarchus, had marched toward the pass of Thermopylae, which, however, he found occupied by the Athenians…
Note that in this case the image physically replaces the first letter. Because of this it is particularly important to set the alt
value of the image correctly, so that if the drop cap image did not load for any reason the paragraph text would still read correctly, with the missing image being replaced with the value of the attribute. For this reason, we would not provide a height
and width
for the image: unlike normal circumstances, we do not want to preserve space for the image in the eventuality that it did not load.
Enjoy this piece? I invite you to follow me at twitter.com/dudleystorey to learn more.