Type Size & Line Height

In Web design, type size is set using one of two CSS properties, either font, which is a shortcut for setting several different font values or font-size, which is used only to set the size. The space between lines of text in a block can also be set in the font property or using the line-height property.


						font: normal 16px/24px century, serif;
					
					
						font-size: 16px;
					
					
						line-height: 24px;
					

Setting Font Size & Line Height

Font sizes can be set as part of the font property short cut or independently.


Any of the relative or absolute size-value units listed earlier in this chapter can be applied to set the font size or line height. Or you can use specific keywords to set absolute sizes, which can then be adjusted with relative-size keywords. Line height can also be set as a numeric value, without any units, setting the spacing between lines as a multiple of the font size.

Understand how type is measured

A typeface’s height is measured from the cap height (the height of the tallest capital letter) to the descender, with some breathing room added at the bottom to prevent characters on different lines from overrunning each other even if the line height is equal to the font size. The exact bottom buffer is set by the type designer. Taller uppercase letters—“b,” “d,” “f,” “h,” “i,” “k,” “l,” and “t”—often rise slightly above the cap height but are not included in the measurement. Although each character in the font might have a different visual height, they occupy the same amount of space vertically, even if they do not fill it.

Even if set to the same size, though, a font’s x-height will likely vary, leading some fonts to look taller than others, and often making them more readable, as is the case between Times and Georgia.

The width of a character is simply its visual width plus any space beside it. The space may vary from letter to letter and can be kerned—the process of adjusting letterspacing to optimize the legibility of that particular font. The one exception to this is monospace fonts, which always occupy the same width regardless of the character.

Differing X-heights

The word “Fax” is displayed in Times and Georgia at the same font size, but notice that Georgia has a taller x-height. Taller x-heights can often make text more readable.


Size fonts with absolute keywords for consistency, and avoid relative keywords

In addition to specific units of measurement, you can set font sizes using relative and absolute keywords. The keywords are self-explanatory, as good keywords should be:

  • Absolute-size keywords— xx-small, x-small, small, medium, large, x-large, and xx-large—set the type to a specific size as defined by the browser. Medium is the default browser font size.

  • Relative-size keywords— smaller and larger—make text smaller or larger relative to its parent element’s font size. Unfortunately, different browsers use different algorithms to determine the relative font size change, making them unreliable for browser interoperability.

In Quirks Mode, Internet Explorer 6 and earlier use “small” rather than “medium” as the browser default, and render the other keyword sizes correspondingly larger. As a consequence, authors using keywords should ensure that their documents are rendered in Standards Mode.


Table 4.3 presents the pixel equivalent size of each of the absolute-size keywords as well as the effect of the relative-size keywords. As mentioned, each browser has a slightly different algorithm for computing relative sizes, so there is some browser variance, which is compounded when relative sizes are nested. Microsoft Internet Explorer and Firefox are the most consistent, but even they vary when using smaller font sizes.

Table 4.3. Font-size keywords with equivalent pixel sizes.
  smaller (px)larger (px)
keywordsize (px)IEFFSaOpIEFFSaOp
xx-small9689810101111
x-small10799913131212
small131010111016161616
medium161313131318181919
large181616151424242222
x-large241818201932322929
xx-large322424272648483838

Dispelling the Above-the-Fold Myth

For many years, the unbreakable rule of Web design was that if you wanted something to be seen, it had to be placed “above the fold.” That is, it had to be in the space of the page that is displayed without scrolling in the Web browser. The term comes from printed newspapers. Important stories would always be placed at the top of the page, above where the paper was folded in half, since those were the stories people would see when the paper was in a vending machine or in a stack with other newspapers.

Applied to Web design, the theory goes that if you want to ensure that your readers see the text, image, or advertisement you really want them to see, it had better appear on the page first. This leads to using small text sizes; crowding columns of text, headlines, and advertisements as close together as possible; and generally cramming every last pixel available with content. This makes a certain amount of sense if your assumption is that viewers hate to scroll. You will then want to concentrate all of their attention on those first few hundred vertical pixels between the top and bottom of the browser window.

There’s only one problem—this is a false assumption. At least it’s an assumption that is no longer as true as it might have once been. Modern Web surfers do not fear scrolling, nor do they seem to pay any more attention to the content at the top of the screen than that down below. In fact, it’s easy to make the argument that modern viewers have been trained to ignore the top of the screen because that’s where all of the “junk” is, like navigation bars and advertisements.

The imaginary fold line has so many variables, including screen resolution, browser, operating system, not to mention the unknowable variable of how large the viewers like their browser window to open, that it becomes pointless to try to figure even an approximate value. Instead, your time is better spent creating engaging designs that are inviting and easy to scan.

For some solid research on the issue, consult Click Tale’s Research Blog, December 23, 2006: Unfolding the Fold (blog.clicktale.com/2006/12/23/unfolding-the-fold).


Although the range for absolute keywords is limited, they are an easy way to quickly apply a set scale to your type. Since relative font sizes are so inconsistently calculated between browsers, they are not recommended.

Setting type size to scale for fluid typography

Consider one fact of Web design: Everything on the screen is resizable, and there is nothing you can do about it. No matter what units you use, all it takes is a keystroke by the user to enlarge the text, potentially upsetting your carefully set type.

Learning to live with and take advantage of the vagaries of Web design will make you a better Web designer, and dealing with your font sizes expanding is no different.

So, the default size of text in a Web browser is medium or 16px. Rather than trying to set all of our font sizes individually, it is better to set a scale. Start with the body font size set to 100% (16px), and then use em values to scale from that size, as desired:


							body {
							font-size: 100%;
						
						
							line-height: 1.125em;
							}
						
						
							h1 {
							font-size: 2em;
							}
						
						
							p {
							font-size: 1em;
						
						
							line-height: 1.5em;
							}
						

Setting a Fluid Font Size

This code sets the base font size to be whatever the default size is set for the browser (we can assum that it is 16px unless the user has adjusted the value), then enlarges that size for headers and holds the same size for paragraphs while increasing the line height.


If you then want to reduce the overall size of text on your page and you are using relative values, you need only change the percentage value set in the body. For example, 75% would create a document with a base font size of 12px, scaling all other sizes proportionally.

Alternatively, if you want more precise control, you can set a pixel value for the body font size to override the browser setting. This may cause some browsers to scale poorly, though, if the user manually increases the text size.

Size header and body copy to improve scannability and readability

One truism of the Web is that readers tend to scan a page. Once they find what they are looking for, they go into reading mode. While we will deal with a more holistic approach to creating scannable text in Chapter 6, the most immediate and reliable way to guide the reader’s eye to important content is through a texture of type sizes. By treating the major page components—headers and body text—with a consistent scale for size, you can create a rhythm that improves scannability.

Smashing Magazine has an excellent analysis of the use of font sizes and spacing in modern Web sites: smashingmagazine.com/typographic.


Heading sizes range between 18 and 32 pixels, while the most popular font sizes for body copy range between 12 and 16 pixels. Smaller font sizes for body copy may be encountered, but they are generally too small for comfortable reading and should be avoided.

A general rule of thumb is that the largest header font should be roughly twice the size of the body copy or larger,

body copy font size × 2 ≤ header font size

with the lower-level headers gradually decreasing, on a consistent scale, in size toward 1em.

One important factor to keep in mind while determining your font size is that 16px is the default font size set by browsers. Text is intended to be at least that large for easy reading. Many designers size body text x-small (10px to 11px) in the belief that it looks better and is easier to design with, especially if you are concerned with getting everything above the imaginary “page fold” or scroll line (see page 112 for more about this). However, larger fonts with a judicious use of white space will create text that is easier to scan and read. You need to give your body copy enough breathing room.

Choose a line height that gives your body copy breathing room

Beyond the size of the text, one of the most frequently overlooked factors in creating readable text is the line height and the width of the column in proportion to the font size. It’s important to stress that line height is not the space between lines of text—as it is often mistakenly thought of—but the space from the baseline of one line of text to the baseline of the next line of text.

A minimum font size to line height ratio of 2:3 is recommended for any extensive body copy:

						body font size × 1.5 ≈ line height

So, a font size of 16px would require a line height of 24px or higher. To simplify matters, you could apply a line height of 1.5em, 150%, or just set a numerical value of 1.5. All of these will add the correct line height, regardless of how the copy is resized.


							line-height: 24px;
						
						
							line-height: 1.5em;
						
						
							line-height: 150%;
						
						
							line-height: 1.5;
						

Setting a Healthy Line Height

All four values will have the same effect on text with a font size of 16px.


In addition to font size, column width affects the optimal line height. Narrow columns and shallower blocks of text, such as headers, require less line height to be quickly scannable. Generally speaking, you can reduce the font size to line height ratio in this case as low as 1:1.125. In order to preserve a more uniform page grid, however, designers often keep the line height consistent regardless of the column width, and use font, style, and color changes to better differentiate columns.

Easy-2-Read

informationarchitects.jp/100e2r/

Oliver Reichenstein’s article in Information Architects Japan on making Web pages easier to read is not only exquisitely well laid out, but also extremely helpful for explaining why most people are using font sizes that are too small. He uses a simple optical test (with a photo provided by Michael Miner) to show that text in a magazine set at 11pt is much closer to Web text set at 16px.


Choose a column width that will not tire your readers out

Another important consideration for readability is the column width. Reading slows the longer a column grows—after a certain amount. A comfortable column width is easily derived from the page’s base font size. Although not an absolute and dependent on the typeface, a good rule of thumb to determine a comfortable column width is to multiply the font size by 28:

						body font size × 28 ≈ column width

This is a rough value. The multiple can range anywhere between 25 and 33, depending on your preference. Generally, though, if we assume a font size of 16px for our body copy, a comfortable column width will be around 450px.

Again, ems can come to our rescue to simplify matters, by allowing us to set a column based on the font size:


							width: 28em;
						

Setting Column Width

Set a fluid width to take full advantage of the screen without creating uncomfortably wide text.


For a fluid design that makes optimal use of the available screen real estate, set the maximum and minimum column widths within the comfort range:


							min-width: 25em;
						
						
							max-width: 33em;
						

The column width will expand or contract as space is available within the Web design, but never stretch too wide or too narrow for comfortable reading.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.218.114.244