Prev

Next

 
Section Four

Notebook

Having browsed many themes for WordPress and creating some myself, I’ve found there is one major design issue that could easily be solved to improve the majority of available themes.

 

Typography. Typography. Typography.

Typography

Moving past the banal title, a higher level of design can be achieved if the typography in your designs is addressed. What I’m presenting in this post is a few CSS tips for improving typography, ways to use CSS to adhere to typography principles and several links to resources that have helped me. So think of it as an acute tutorial for stepping in the right direction towards better typography.

Breathing Room

We’ll use a paragraph of text as an example to demonstrate a few simple techniques for improving typography. For sake of example, let’s say that the markup in Figure 1 and the CSS in Figure 2 produce the block of text in Figure 3.

  1. <div class="post">
  2. <p>
  3. [text]
  4. </p>
  5. </div>
Figure 1: Markup for example block of text.

  1. .post
  2. {
  3. padding:20px;
  4. font-family:Helvetica, Arial, sans-serif;
  5. font-size:13px;
  6. }
Figure 2: Styling for example block of text.

Figure 3: The text block with default styling.

The default version (Figure 3) is functional when it comes to readability, but not optimal. Our task will be to increase the leading and to optimize the measure for maximum readability.

Now, if you’re like me before reading Mark Boulton’s great articles on typography (links included at the end of this post), you won’t know the definition for the terms “measure” or “leading”. Basically, the measure is the width of the block of text, and leading is the space between lines of text. In CSS, leading is controlled by the line-height property, and the measure by a variety of different properties depending on the context of the element being styled.

The first step we’ll take to improve the typography in our example paragraph is to increase the leading. In Figure 4 the line-height property is added to the CSS to produce the results seen in Figure 5.

  1. .post
  2. {
  3. padding:20px;
  4. font-family:Helvetica, Arial, sans-serif;
  5. font-size:13px;
  6. line-height:20px;
  7. }
Figure 4: Adding the line-height property to the block of text.

Figure 5: Formatting after increasing the leading.

With this simple property added to the CSS, the block of text is much more readable. The next change we’ll make isn’t a matter of advanced CSS but more typographical principle.

The width of the text block is about as wide as I would go for the size of the example font, maybe even a little too wide. So we’ll reduce the measure by adding more padding to the right and see if the results are more favorable than the current condition. There’s no fancy CSS here, just increasing the padding property (Figure 6) which produces the results seen in Figure 7.

  1. .post
  2. {
  3. padding:20px 80px 20px 20px;
  4. font-family:Helvetica, Arial, sans-serif;
  5. font-size:13px;
  6. line-height:20px;
  7. }
Figure 6: Adding more padding to the block of text to reduce the measure.

Figure 7: The text block with a smaller measure.

I like the look of the paragraph in Figure 7 better than Figure 5, but we’re beginning to get into the more abstract realm of personal opinion and away from established principles. Although, if the paragraph in Figure 5 were twice as wide, then clearly we would have a problem. That would be too wide and the eye would tire from having to follow a single line for that amount of length. As a general rule (that I learned from Mark Boulton’s articles) I like to keep the number of characters on a single line in a range of 52 to 78 characters (including spaces).

Finally, CSS allows us to do some neat things with our test paragraph. For example, you can add the pseudo-selector :first-line to an element to style the first line of the text differently from the rest of the paragraph. In this example we will transform the first line of our paragraph to uppercase (see Figures 8 and 9).

  1. .post
  2. {
  3. padding:20px 80px 20px 20px;
  4. font-family:Helvetica, Arial, sans-serif;
  5. font-size:13px;
  6. line-height:20px;
  7. }
  8. .post p:first-line
  9. {
  10. text-transform:uppercase;
  11. }
Figure 8: Adding a pseudo-selector to style the first line differently.

Figure 9: Having the first line all uppercase adds a new dimension to the typography.

This adds a touch of professionalism to your design, and will probably earn you a “nice work” from the client! However, make sure you use your advanced CSS skills wisely within the context of your content.

Discovery

As you experiment with typography you will begin to develop your own best-practices. Your knowledge base grows and you become more proficient. For example, while designing this site and choosing Georgia for the body copy, I found that when sizing with pixels, even numbers looked better than odd numbers. Compare the different sizes in Figure 10 and see if you agree.

Georgia at a font size of 11px. Georgia at a font size of 12px.
Georgia at a font size of 13px. Georgia at a font size of 14px.
Georgia at a font size of 15px. Georgia at a font size of 16px.Figure 10: Comparing font sizes with the font Georgia (note, however, that this is in Firefox on Windows, so results may vary)

Resources

Not to leave you empty-handed, I’ve ended this post with links to the “Five Simple Steps to Better Typography” series that has helped me immensely and one invaluable CSS resource in case you have not been using it.

CSS
A quick, easy and effective way to learn (and refresh your memory) the properties of CSS.

Typography Principles
Mark Boulton’s five simple steps to better typography.

Commentary

1. Jun 21, 2007 firman firdaus says

thank you. especially for the “first line” part. I usually make it manually.

2. Aug 10, 2007 Blog Design Review: Problogger says

[…] Room to breathe. There is a lot of information on every page, but it doesn’t feel that way. The layout is wider than previously, giving a lot more space to work with. Instead of cluttering that space, Ben has used ample padding. […]

Join the Discussion




*Required


 
 
04.Notebook