July 22, 2004

More CSS Shorthand

Today we'll cover the CSS Shorthand for font. (I know, this is pretty straightforward stuff. I'm just busy, yet still want to post something that might help someone. This is easy.)

Okay, the following is from the W3C Spec:

font: font-style | font-variant | font-weight | font-size/line-height | font-family | caption | icon | menu | message-box | small-caption | status-bar | inherit

Now this is from CSS 2. And I have not messed around with caption | icon | menu | message-box | small-caption | status-bar. And as stated above, I'm fairly busy today. So we're going to skip that.

All of the following examples are valid:

p { font: 11px/1.2em sans-serif }
p { font: 80% sans-serif }
p { font: x-large/110% "New Century Schoolbook", serif }
p { font: bold italic large Palatino, serif }
p { font: normal small-caps 120%/120% fantasy }

A little confusing? Not really. Just remember that the first three rules (font-style, font-variant, font-weight) are set to normal if not mentioned. Any value not explicitly given a value is reset. (Normal, inherited value, whatever.)

See? Pretty straightforward. Style, Variant, Weight, Size/Hight, Family.
SVWSHF

"So Very Willing to SHoot Fish"?
"Steve Vascik Wants to SHine Fenders"? (sorry Steve) You can make your own.

Post Info

Tagged As CSS, Tip

Comments are Open (0)

Posted at 10:02 AM

Post a comment

(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)

Search
Comments on this post
Categories
Info
Tony Stephens
Copyright © 1995-2005
Site Version:
10
Licensed:
Creative Commons
Validate:
XHTML, CSS, 508, RSS
Subscribe
Blog-Fu, Link-Fu