Publishers of technology books, eBooks, and videos for creative people

Home > Articles > Web Design & Development > Usability

This chapter is from the book

This chapter is from the book

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;

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.

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.

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 Fire-fox 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)

keyword

size (px)

IE

FF

Sa

Op

IE

FF

Sa

Op

xx-small

9

6

8

9

8

10

10

11

11

x-small

10

7

9

9

9

13

13

12

12

small

13

10

10

11

10

16

16

16

16

medium

16

13

13

13

13

18

18

19

19

large

18

16

16

15

14

24

24

22

22

x-large

24

18

18

20

19

32

32

29

29

xx-large

32

24

24

27

26

48

48

38

38

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; }

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.

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;

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.

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;

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.

Peachpit Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from Peachpit and its family of brands. I can unsubscribe at any time.

Overview


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about Peachpit products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information


To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.

Surveys

Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites; develop new products and services; conduct educational research; and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.

Newsletters

If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email ask@peachpit.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information


Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.

Security


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.

Children


This site is not directed to children under the age of 13.

Marketing


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information


If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.

Choice/Opt-out


Users can always make an informed choice as to whether they should proceed with certain services offered by Adobe Press. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.peachpit.com/u.aspx.

Sale of Personal Information


Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents


California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure


Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.

Links


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact


Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice


We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020