Versal letters on the web

Because it’s type-​related I couldn’t resist waiting another day before pub­lish­ing this…

…Yesterday I was going through an old un-​named sketch book. Right at the back were these beau­ti­ful hand-​drawn versal letters and an entire page of weaving orna­ments:

Photograph of some hand-drawn versals
Close-up photograph of an R versal

Versals, drop cap­i­tals or raised cap­i­tals are large and often ornately dec­o­rated capital letters marking the opening of a running body of text or a verse.

Modern typog­ra­phy has dis­carded much of these clas­si­cal dec­o­ra­tions in favour of a more clin­i­cal page; these par­tic­u­lar orna­ments above aren’t as mul­ti­cul­tural and cer­tainly not as neutral as modern typog­ra­phy which aims to better cater for a larger and more mul­ti­cul­tural audi­ence.

I would like to see a revival of this form of dec­o­ra­tion; I think a lot can be done with typog­ra­phy that cur­rently scores of artists—particularly web designers—are trying to achieve with stock pho­tog­ra­phy and ever popular vibrant, reflec­tive and glossy ele­ments.

Setting versals in CSS isn’t par­tic­u­larly hard. A common method is to use the pseudo-​selector :first-letter to refer to the first letter of an element. You can combine this with other selec­tors to refer to the first letter of the first para­graph of a page, heading, or what­ever else strikes your fancy (uti­liz­ing the DOM struc­ture prop­erly is helpful in making this work prop­erly). Note Inter­net Explorer doesn’t recog­nise many of the CSS 2.1 selec­tors (IE does however under­stand :first-letter).

Another common method is to just man­u­ally wrap the first letter in span tags with a spe­cific class of desired styling. What­ever you choose, the styling might look some­thing like this:

div#content h2.entry-title + p:first-letter {
font-size: 4.2em;
float: left;
display: in-line;
text-transform: uppercase;
}

You may also want to set margins and line-height to better place the versal amongst the rest of the para­graph. The float: left; is optional—it wraps the para­graph around the versal—if you want the versal to stand on the base­line of the opening line of the para­graph then don’t set the float.

Tar­get­ing the first letter and styling it was simple; browser con­sis­tency is the hair-​pulling part. Inter­net Explorer in par­tic­u­lar com­pli­cates things because it doesn’t under­stand the pre­ced­ing selec­tor (element + first-child). If your versals are vital to the page, see Bill Weaver’s article, Wran­gling Drop Caps, which goes into closer detail on the subject includ­ing a JavaScript method.

When print­ing a page in Inter­net Explorer fea­tur­ing a versal spec­i­fied using the pseudo-​selector :first-letter IE bizarrely dis­places other floated ele­ments in prox­im­ity to the para­graph. See Nicholas Rougeux’s article Drop caps in the wild for an example.

Finding versal letters with further dec­o­ra­tion done other than through size and place­ment is a rarity on the web. Replac­ing the first letter entirely with a graphic isn’t impos­si­ble but you’re bound to run into many acces­si­bil­ity issues using image replace­ment on the fly (and getting the right letter—that means design­ing twenty four versals and some script­ing). I did however see a simple method last week of adding a bit more to versals by a bright Polish designer:

designr.com opening versal

Piotr Fedor­czyk drew ornate back­ground images and placed them behind the versal giving a them that extra love. The only issues here would be vis­i­bil­ity of the back­ground image depend­ing on the letter size—an “I” is smaller in width than a “R” or “Q”, and of course text resiz­ing. The CSS now would look some­thing like this:

div#content h2.entry-title + p:first-letter {
font-size: 4.2em;
float: left;
display: in-line;
text-transform: uppercase;
background-image: url(../images/versal-bg.png);
background-repeat: no-repeat;
background-position: center center;
}

You can see them in action at Piotr’s site.

10 comments

  1. 1. Taco Buitenhuis
    May 27, 19:51

    Some­times I wonder why we keep both­er­ing with HTML. PDFs can contain hyper­links too and they look the same every­where. Use any versal font you like, no need for CSS and JavaScript tricks to get a half as nice result.

    Really. Why HTML?

  2. 2. Pascal
    May 27, 21:51

    Call me out if I speak the bol­locks here, but aren’t PDFs more dif­fi­cult to index, and of a larger file size?

  3. 3. Taco Buitenhuis
    May 28, 01:32

    More dif­fi­cult to index: pos­si­bly, but Google doesn’t seem to have any trouble with them.

    File size: PDF should be smaller for big doc­u­ments and complex layouts. Don’t forget to add the sizes of sep­a­rate images when com­par­ing to HTML. Also, does it still matter?

    Bonus point for PDF: nice lig­a­tures, espe­cially when you use TeX. With XeTeX one gets to use nice fonts, too, but I still have to try that.

  4. 4. Pascal
    May 28, 04:33

    It’s def­i­nitely true that PDF offers higher degrees of typo­graph­i­cal control but I doubt a change from HTML to PDF would be viable today; there has just been too much invested into the HTML infra­struc­ture and support. The new media cre­ative types wouldn’t be par­tic­u­larly fond of such a more either as they loose all the Flash wankery (and think of all the glossy web apps!).

  5. 5. johno
    May 28, 04:26

    @Taco Buiten­huis: And why not just use paper? PDF is not a viable alter­na­tive to HTML. HTML is the lan­guage of the Web, and as such it does an excep­tional job. PDF doc­u­ments require a plugin. And then what about menus and JavaScript and ani­mated content? (an entire web site, a blog, perhaps, as a a col­lec­tion of PDFs?) HTML plus CSS plus JavaScript, plus script­ing lan­guages (e.g. PHP), plus the ability to deliver content from numer­ous kinds of data­bases, plus greater acces­si­bil­ity, plus reduced file sizes….

    The above article is an excel­lent one because it demon­strates that good typog­ra­phy on the Web is possible/accessible.

  6. 6. Alex
    May 28, 06:51

    For the pur­poses of infor­ma­tion inter­change, XML formats beat binary file formats, such as PDF. This is what the web was created for.

    You’d be writing some very com­pli­cated binary parsers to even begin to emulate the flow of XML (or even some­thing like JSON), for example Google-​maps style mashups would be basi­cally impos­si­ble.

    The lines are becom­ing slightly blurred with XML tagged PDF doc­u­ments, but then you’re still needing to fall back on XML.

    Also some­times I like to ViewPage StyleNo Style. The control has to be with the user.

  7. 7. dylunio
    May 28, 06:01

    Those are some beau­ti­ful glyphs… though I’m trying to think how they would create the molds for them.

  8. 8. Piotr
    Jun 03, 17:36

    Hi! Thanks for men­tion­ing my site here. You have a bit out­dated screen­shot of my folio’s drop­caps ;-)

    Plus: I’m not Italian, I’m Polish.

    Kind regards, Piotr

  9. 9. Pascal
    Jun 03, 20:34

    @Piotr: Sorry mate—fixed!

  10. 10. Matt
    Jun 05, 13:15

    Cool! I’ve seen CSS used to create a large cap first letter of an article/paragraph. Never even thought about adding a back­ground image to create an older style look.

    And thanks for the heads up about the IE bugs.

Post a comment

Please share your thoughts or add a note if I missed something.

Required fields are marked by an asterisk (*). Your e-mail address is never published nor shared. You can use common text formatting XHTML elements (e.g. a, acronym, blockquote, code, em, strong, …). If you’d like to directly respond and link to another comment, you can do that using the Twitter-style @reply (i.e., @Randy Bender: …).

*
*