XML technologies / CSS / CSS Cookbook / Typography for the web / Setting your own font sizes

(Excerpt from “CSS Kochbuch” by Christopher Schmitt)

Problem

You want to override user-defined font sizes with your own values.

Solution

Use an !important rule to override the values in the user stylesheet:

p {bn
 font-size: 12px !important;
}

Discussion

An !important rule consists of an exclamation mark (!) immediately followed by the word important.

Some browsers let users specify a stylesheet with their preferred font sizes and other CSS properties. As the document’s designer, however, you want your designs to appear as planned. The !important rule provides a little insurance that your designs remain intact. (Remember, though, that the nature of the medium prevents absolutely precise or pixel-perfect designs.)

Using !important rules does not guarantee that a browser will use your design, because users can include them in their own stylesheets. User-defined !important rules take precedence over the designer’s rules.

See also

The CSS 2.1 specification on !important rules.

  

 

 

 

back to top