Current location: Hot Scripts Forums » General Web Coding » CSS » CSS font shorthand rule


CSS font shorthand rule

Reply
  #1 (permalink)  
Old 01-27-09, 12:29 AM
ajit22 ajit22 is offline
Newbie Coder
 
Join Date: Jan 2009
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
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.
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
CSS for the Firefox UI (Chrome) Crane CSS 0 10-19-08 02:26 PM
css page layout questions from n00b outhowz42 CSS 4 07-06-08 09:49 AM
[SOLVED] [2005] ToolStripComboBox with Font Styles? tim8w Windows .NET Programming 1 04-21-08 11:10 AM
Brush Script Std font for CSS zoliky CSS 1 08-13-07 11:12 AM
Font Script Needed Granat Networks Script Requests 0 10-28-04 08:02 PM


All times are GMT -5. The time now is 02:17 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.