Library code snippets
CSS font shorthand rule
When styling fonts with CSS you may be doing this:
font-weight: bold;
font-style: italic;
font-variant: small-caps;
font-size: 1em;
line-height: 1.5em;
font-family: verdana,sans-serif
There's no need though as you can use this CSS shorthand property:
font: bold italic small-caps 1em/1.5em verdana,sans-serif
Much better! Just a few of words of warning: This CSS shorthand version will only work if you're specifying both the font-size and the font-family. The font-family command must always be at the very end of this shorthand command, and font-size must come directly before this. Also, if you don't specify the font-weight, font-style, or font-variant then these values will automatically default to a value of normal, so do bear this in mind too.
Related articles
Related discussion
-
Header and Footer in Web page print
by fhajaj (4 replies)
-
Horizontal and vertical centering of a Update panel progress bar in a page. How?
by nayyarmalhi (0 replies)
-
Streaming web video
by kruelintent (0 replies)
-
Filter Datagrid using AJAX
by ashish.ubale (0 replies)
-
Dynamic image map for asset management
by DELABRE (0 replies)
Related podcasts
-
Episode 3: Anne van Kesteren on CSS, XHR, and other Web standards
Anne van Kesteren is an Opera Software employee who is deeply involved in the standards community. Just take a look at his page on the WHATWG site and you will see the many specifications that he is actively working on, such as: access-control XMLHttpRequest XMLHttpRequest2 cssom-view css3-media...
Events coming up
-
Dec
8
Web Design World
Boston, United States
Join your colleagues and top experts in the Web field as Web Design World returns to Boston December 8-10, 2008 for three dynamic days of information, interaction, insight and inspiration.
This thread is for discussions of CSS font shorthand rule.