Posts Tagged ‘Care With Font Size’

The font-variant property -> Small caps!

Wednesday, November 11th, 2009

Technical Tip – CSS!

“Font-Variant”

Value: normal | small-caps | inherit
Initial: normal
Applies to: all elements
Inherited: yes
Percentages: N/A
Media: visual
Computed value: as specified

Another type of variation within a font family is the small-caps. In a small-caps font the lower case letters look similar to the uppercase ones, but in a smaller size and with slightly different proportions. The ‘font-variant’ property selects that font.

A value of ‘normal’ selects a font that is not a small-caps font, ‘small-caps’ selects a small-caps font. It is acceptable (but not required) in CSS 2.1 if the small-caps font is a created by taking a normal font and replacing the lower case letters by scaled uppercase characters. As a last resort, uppercase letters will be used as replacement for a small-caps font.

The following example results in an ‘H3′ element in small-caps, with any emphasized words in oblique, and any emphasized words within an ‘H3′ oblique small-caps:

h3 { font-variant: small-caps }
em { font-style: oblique }

There may be other variants in the font family as well, such as fonts with old-style numerals, small-caps numerals, condensed or expanded letters, etc. CSS 2.1 has no properties that select those.

Note: insofar as this property causes text to be transformed to uppercase, the same considerations as for ‘text-transform’ apply.

Share

Care With Font Size!

Friday, September 4th, 2009

A certain trend among designers, believing that small text gives a Web page a sleek appearance and provides more space per “page” for actual content, sometimes results in the use of unreasonably small font sizes.

Unfortunately, this does not go well with the diversity of platforms used to access Web pages, from portable devices with tiny screens to projection devices hooked to computers. And even within a specific platform, text settings may vary.

The problem here is a basic usability and accessibility issue: a good design should look good without requiring the user to enlarge or reduce the text size.

Forget <font>, use CSS

The proper, modern way to set the size of the text displayed in a Web page is to use Cascading Style Sheets. This is strongly recommended over the use of <font> tags in HTML, because CSS is more flexible, easier to maintain and saves bandwidth. It is not the purpose of the Tip to discuss the interest of CSS versus <font> tags, readers wanting more details on this issue will ask their favorite Web search engine for related information… We will focus on good usage of the CSS technology to create legible Web pages.

Good usage of CSS’s font properties

Here are a few basic rules that one should follow in order to create Web pages that are easy (enough) to read, using CSS’s font properties.

Size: respect the users’ preferences, avoid small size for content

  • As a base font size for a document, 1em (or 100%) is equivalent to setting the font size to the user’s preference. Use this as a basis for your font sizes, and avoid setting a smaller base font size
  • Avoid sizes in em smaller than 1em for text body, except maybe for copyright statements or other kinds of “fine print.”

Units: avoid absolute length units for screen display

  • Do not specify the font-size in pt, or other absolute length units for screen stylesheets. They render inconsistently across platforms and can’t be resized by the User Agent (e.g browser). Keep the usage of such units for styling on media with fixed and known physical properties (e.g print).
  • Use relative length units such as percent or (better) em
  • even better, if a base font-size is set for the document, use absolute size ([ xx-small | x-small | small | medium | large | x-large | xx-large ]) or relative size ([ larger | smaller ]) when defining the font size for a particular element within the document.

legible font-family

If using a small font-size, prefer a legible font-family with a high aspect value (see the section on font-size-adjust in the CSS2 specification for an explanation of the aspect value), which are more likely to be legible at such small sizes.

Share