Lably
Skip to content

Web typography

  • 10 min read
  • 4 chapters

Related on Lably

Through Typesetting, World Wide Web and CSS

When HTML was first created, typefaces and styles were controlled exclusively by the settings of each web browser. There was no mechanism for individual Web pages to control font display until Netscape introduced the font element in 1995, which was then standardized in the HTML 3.2 specification. However, the computer font specified by the font element had to be installed on the user's computer or a fallback font, such as a browser's default sans-serif or monospace font, would be used. The first CSS specification was published in 1996 and provided the same capabilities.

The CSS2 specification was released in 1998 and attempted to improve the font selection process by adding font matching, synthesis and download. These techniques did not gain much use, and were removed in the CSS2.1 specification. However, Internet Explorer added support for the font downloading feature in version 4.0, released in 1997. Font downloading was later included in the CSS3 fonts module, and has since been implemented in Safari 3.1, Opera 10 and Mozilla Firefox 3.5. This has subsequently increased interest in Web typography, as well as the use of font downloading.

CSS1

In the first CSS specification, authors specified font characteristics via a series of properties:

  • font-family
  • font-style
  • font-variant
  • font-weight
  • font-size

All fonts were identified solely by name. Beyond the properties mentioned above, designers had no way to style fonts, and no mechanism existed to select fonts not present on the client system.

Web-safe fonts

Web-safe fonts are computer fonts that may reasonably be expected to be present on a wide range of computer systems, and used by Web content authors to increase the likelihood that content displays in their chosen font. If a visitor to a Web site does not have the specified font, their browser tries to select a similar alternative, based on the author-specified fallback fonts and generic families or it uses font substitution defined in the visitor's operating system.

Microsoft's Core fonts for the Web

To ensure that all Web users had a basic set of fonts, Microsoft started the Core fonts for the Web initiative in 1996 (terminated in 2002). Released fonts include Arial, Courier New, Times New Roman, Comic Sans, Impact, Georgia, Trebuchet, Webdings and Verdana—under an EULA that made them freely distributable but also limited some rights to their use. Their high penetration rate has made them a staple for Web designers. However, most Linux distributions don't include these fonts by default.

CSS2 attempted to increase the tools available to Web developers by adding font synthesis, improved font matching and the ability to download remote fonts.

Some CSS2 font properties were removed from CSS2.1 and later included in CSS3.

Fallback fonts

The CSS specification allows for multiple fonts to be listed as fallback fonts. In CSS, the font-family property accepts a list of comma-separated font faces to use, like so:

<span id="mwbg"></span><span class="nt" id="mwbw">font-family</span><span class="o" id="mwcA">:</span><span class="w" id="mwcQ"> </span><span class="s2" id="mwcg">"Nimbus Sans L"</span><span class="o" id="mwcw">,</span><span class="w" id="mwdA"> </span><span class="nt" id="mwdQ">Helvetica</span><span class="o" id="mwdg">,</span><span class="w" id="mwdw"> </span><span class="nt" id="mweA">Arial</span><span class="o" id="mweQ">,</span><span class="w" id="mweg"> </span><span class="nt" id="mwew">sans-serif</span><span class="o" id="mwfA">;</span>

The first font specified is the preferred font. If this font is not available, the Web browser attempts to use the next font in the list. If none of the fonts specified are found, the browser displays its default font. This same process also happens on a per-character basis if the browser tries to display a character not present in the specified font.

Generic font families

To give Web designers some control over the appearance of fonts on their Web pages, even when the specified fonts are not available, the CSS specification allows the use of several generic font families. These families are designed to split fonts into several categories based on their general appearance. They are commonly specified as the last in a series of fallback fonts, as a last resort in the event that none of the fonts specified by the author are available. For several years, there were five generic families:

Sans-serif

Fonts that do not have decorative markings, or serifs, on their letters. These fonts are often considered easier to read on screens.

Serif

Fonts that have decorative markings, or serifs, present on their characters. These fonts are traditionally used in printed books.

Monospace

Fonts in which all characters are equally wide.

Cursive

Fonts that resemble cursive writing. These fonts may have a decorative appearance, but they can be difficult to read at small sizes, so they are generally used sparingly.

Fantasy

Fonts that may contain symbols or other decorative properties, but still represent the specified character.

CSS fonts working draft 4 with lesser browser support

As of February 2024, the CSS Working Group of W3C proposes that systems specify a default font using ui tags; as of the same date, these are not widely supported yet.

  • System-ui
    Default fonts on a given system: the purpose of this option is to allow web content to integrate with the look and feel of the native OS.
  • ui-serif
    Default fonts on a given system in a serif style
  • ui-sans-serif
    Default fonts on a given system in a sans-serif style
  • ui-monospace
    Default fonts on a given system in a monospace style
  • ui-rounded
    Default fonts on a given system in a rounded style
  • Emoji
    Fonts using emoji
  • Math
    Fonts for complex mathematical formula and expressions.
  • Fangsong (Chinese: 仿宋体)
    • Chinese typefaces that are between serif Song and cursive Kai forms. This style is often used for government documents.

Sign in to keep reading

3 more chapters are free with a Lably account.

More in Computing and communication