style guide
The Shorthand Font Property
The shorthand <font> property does the job of combining all the font properties into one. This makes it easier to specify a set of font properties within one rule. Take a look at the following example.
h1 {font-size: large; font-family: Verdana, Arial, sans-serif; font-weight: bold; font-style: oblique; font-variant: small-caps;
Instead of this long drawn out rule, we can define all those properties together, as follows:
h1 {font:oblique bold small-caps large Verdana, Arial, sans-serif;}
There is one very important point that you must not forget when using the <font> property. The last two rules must always be the ‘font size’ value, followed by the ‘font family’ value. Any of the other values can be placed anywhere in the rule, but if these two rules are missing, in the wrong order, or not at the end of the rule, then the code will be invalid. This will cause most browsers to ignore the rule completely.
The shorthand <font> property is extremely useful and is a rule that you will use very frequently when working with CSS. Always calculate the best way to declare your font properties, and decide whether it is easier to declare them as seperate rules or combine them in to the one.
Previous Posts
Latest Links
- Trumpet Quartet
- Bella Tromba this week recording at EMI with Kanye West.
- Are we designers or developers?
- I struggle with this one as well. My title at work is Software Engineer as well, which doesn't help matters.
- Dear W3C, Dear WaSP
- I'm not sure what I think about this. There seems to be a lot of general moaning about this stuff and not very much doing (with a few notable exceptions).
- The King of Web Standards
- Jeffrey Zeldman crowned by Business Week Magazine
- iPhone Javascript and spec benchmark
- Interesting JavaScript benchmarks on the new iPhone vs. Mac Book Pro
