Unique Marketing, Guaranteed Results.

CSS Font Styling Shorthand

April 23rd, 2009 by Mister Mc

Here’s a quick reference on how to style all of your font properties (and one text property: line-height) in one rule.

font: weight | variant | style | size/line height | font-family

font: bold small-caps italic 1em/1.25 Georgia, "Times New Roman", Times, serif;

For this to work, you must include font-size and the font-family (in that order).  They must also be the last two values listed.  If you leave out values, those values will render in their default state, ignoring inheritance and other group selectors.

Line height is optional.  Note that line height doesn’t have a unit.  Eric Meyer explains why.

Filed under: Design — Tags: , — Mister Mc @ 12:46 pm on April 23, 2009

1 Comment

  1. Good reference. I’m always lazy and end up doing it all long hand. I know shorthand helps to optimize your code and load faster so I know anyone looking to speed up their sites should appreciate this. Thanks Mister Mc

    Comment by Brandon Buttars — April 24, 2009 @ 9:39 am

RSS feed for comments on this post. TrackBack URL

Leave a comment

Copyright © 2005-2016 PMA Media Group. All Rights Reserved &nbsp