with Imagination: by Dustin Diaz

./with Imagination

A JavaScript, CSS, XHTML web log focusing on usability and accessibility by Dustin Diaz

CSS Shorthand Guide

Sunday, October 23rd, 2005

Ok. Let’s set the record straight. There is no official guide for each and every CSS shorthand property value. So let’s work together and put one together shall we? Ok. Straight to the business. Anytime I’ve ran into a specification (besides the confusing mess at the W3C), it turns into showing off a couple of examples and you’re supposed to be set on your way. Well well. Over the years, I’ve found quite some interesting unknown quirky facts about these shorthands… hence this Guide was born.

Background

Backgrounds can be tricky. Nevertheless, effective when condensed correctly. The syntax for declaring the background shorthand values are as follows:

background properties

element {
  background-color: color || #hex || (rgb / % || 0-255);
  background-image:url(URI);
  background-repeat: repeat || repeat-x || repeat-y || no-repeat;
  background-position: X Y || (top||bottom||center) (left||right||center);
  background-attachment: scroll || fixed;
}


Believe it or not, all these properties can be combined into one single background property as follows:

the background shorthand property

element {
  background:
    #fff
    url(image.png)
    no-repeat
    20px 100px
    fixed;
}

The Unknown

Often times developers find themselves wondering What if I leave out this value or that one? How will that effect the design?. Good questions.

By default, the background property will assume the following when you do not declare each value of the properties.

default background property values


element {
  background-color: transparent;
  background-image: none;
  background-repeat: repeat;
  background-position: top left;
  background-attachment: scroll;
}

Lesson learned: be careful on what you don’t declare. By chosing to not declare a value on a shorthand property, you are explicitly declaring the above default settings. For example, let’s look at the following example.

background shorthand example (unexplicit)

element {
  background:red url(image.png);
}

This would be the same as declaring the following values:

background shorthand example (explicit)

element {
  background:red url(image.png) repeat top left scroll;
}

Font

Font is perhaps the trickiest. However, it follows the same rules as the background shorthand property. All that you do not declare will have unexplicit values. Here is the font shorthand specification:

font properties

element {
  font-style: normal || italic || oblique;
  font-variant:normal || small-caps;
  font-weight: normal || bold || bolder || || lighter || (100-900);
  font-size: (number+unit) || (xx-small - xx-large);
  line-height: normal || (number+unit);
  font-family:name,"more names";
}

The default values for the font shorthand property are as follows:

default font property values

element {
  font-style: normal;
  font-variant:normal;
  font-weight: normal;
  font-size: inherit;
  line-height: normal;
  font-family:inherit;
}

And of course without any further ado. The font shorthand property syntax:

the font shorthand property

element {
  font:
    normal
    normal
    normal
    inhert/
    normal
    inherit;
}

Here is where it gets tricky. The fact that font-style, font-variant, and font-weight all come “normal” out of the box, you may need to pay a little more close attention when you’re styling elements that come with default browser styles like <h1> - <h6> or <strong> and <em>. For example, styling the strong element:

strong element styled with font

strong {
  font:12px verdana;
}

By writing the above into your style sheet, you will be unexplicitly removing the font-weight:bold default browser style that is applied to strong elements.

Last but not least (for -font- that is), a real world example:

font shorthand property example (unexplicit)

p {
  font:bold 1em/1.2em georgia,"times new roman",serif;
}

This would be the same as declaring the following properties:

the font shorthand property (explicit)

p {
  font-style:normal;
  font-variant:normal;
  font-weight:bold;
  font-size:1em;
  line-height:1.2em;
  font-family:georgia,"times new roman",serif;
}

Border

Let’s not waste time discussing the warnings. The same rules apply from here on out. This is all you need to know

border properties

element {
  border-width: number+unit;
  border-style: (numerous);
  border-color: color || #hex || (rgb / % || 0-255);
}

becomes this:

the border shorthand propertie

element {
  border:
    4px
    groove
    linen
}

Don’t ask me how that would look. The fact that “linen” is in there, things could get scary. Nevermind the matter, here is where ‘border’ gets funny.

border examples

p {
  border:solid blue;
}
/* will create a '3px' solid blue border...
   who knows where 3px came from?? */

p {
  border:5px solid;
}
/* will create 5px solid 'black' border...
    default must be black?? */

p {
  border:dashed;
}
/* will create a '3px' dashed 'black' border...
    3px black lines unite! */

p { border:10px red; }
p { border:10px; }
p { border:red; }
/* these just don't even work */

One thing to specially take note about declaring a border without a color, the default will be ‘black’ unless otherwise noted through an explicit or inherited ‘color’ property. See the following examples:

border color examples


p {
  border:dotted;
  color:red;
}
/* will create a 3px dotted red border */
/* ----------------------------- */
body {
  color:blue;
}
body p {
  border:5px solid;
}
/* will create a 5px solid blue border */
/* ----------------------------- */

Get it? Got it. Good! (isn’t that a song?) Anyway. On with this

Margin and Padding

These are by far the easiest. Just think about the hands of a clock starting at noon, and follow the hour. For the sake of brevity, we’ll be working with margin (since it’s a shorter word). So for all cases of margin, the same rules apply to padding.

margin properties.

element {
  margin-top: number+unit;
  margin-right: number+unit;
  margin-bottom: number+unit;
  margin-left: number+unit;
}

… combined into the margin superpowers:

the margin shorthand property

/* top right bottom left */
element {
  margin: auto auto auto auto;
}

Of course, you may declare your margin with one, two, three, or four values. Here is how each scenario will be played out:

margin fun

/* adds a 10px margin to all four sides */
element {
  margin:10px;
}

/* adds a 20px margin to top and bottom
    and a 5px margin to left and right */
element {
  margin:20px 5px;
}

/* adds a 50px margin to top
    and a 10px margin to left and right
    and a 300px margin to bottom */
element {
  margin:50px 10px 300px;
}

Understood? Let’s keep going. This is fun isn’t it! (whatever, you like it).

Outline

Quite frankly, this property has dropped off the existence of the design radar. Mainly because of lack of browsers supporting this CSS 2.1 standard (yep, it’s an actual property), but nonetheless, it too has a shorthand property. This property follows the exact same (or same exact - they mean the same thing) specification as the ‘border’ shorthand property. But, for purposes of this being a Guide, it must be here. So:

outline properties

element {
  outline-width: number+unit;
  outline-style: (numerous);
  outline-color: color || #hex || (rgb / % || 0-255);
}

Outline written as shorthand:

outline shorthand property

element {
  outline:3px dotted gray;
}

For purposes of trying to keep things from repeating, please see the border shorthand section on this document to understand the odds, ends, and quirks of the outline property.

List-style

This is it. The last one. It’s rarely used frequently. Hence rarely. That is why I kept it until the end (sorry, the best was first in my own opinion). Here is the list-style properties:

list-style properties

element {
  list-style-type: (numerous);
  list-style-position:inside || outside;
  list-style-image:url(image.png);
}

Here is the defaults:

list-style property defaults

element {
  list-style-type:disc;
  list-style-position:outside;
  list-style-image:none;
}

And for the sake of final brevity. Here is a simple example:

list-style shorthand property example

ul li {
  list-style:square inside url(image.png);
}
/* in this particular case if image.png is not available
    then a square will be provided as secondary */

That’s it!

I hope this provides years and years of referencing for all your CSS shorthand needs. When CSS3 is finally outside its working draft, expect to see this guide updated as necessary.

165 Responses to “CSS Shorthand Guide”

  1. jordan

    One thing I’ve never understood is the use of (viz) 1em/1.2em on font tags. How exactly does that work? What’s the difference between that and just, say, 1em?

    I’ve only seen it a few times, but I really don’t get it.

  2. Gregor

    Hey Jordan,

    1em/1.2em means font-size: 1em & line-height:1.2em

  3. Heiko

    Well done, nie tutorial about shorthand properties. Hi Jordan means - 1em(font-size)/1.2em(line-height). I prefer this method too.

  4. Kelsey Ruger

    Jordan on a font taf like this “(viz) 1em/1.2em” the 1em represents the font size and the 1.2em represents the line height. It’s a shortcut for handling font size and line height at once.

  5. Jesse

    Hey Jordan, The 1em/1.2em is equal to font size / line-height… or

    font-size:1em;
    line-height:1.2em;

  6. Neil Crosby

    Jordan - The 1em/1.2em syntax says (IIRC) that the text itself should be 1em in size, but the line-height of the line that it sits on should be of size 1.2em.

    Dustin - I just found this entry via the del.icio.us popular pages. Thanks for a nice easy to overview of CSS shorthand.

  7. Rob

    When you use the the 1em/1.2em format, the line-height(leading) is set to 1.2em and the font-size is set to 1.0 em. Without the slashed setting, the line-height remains at the inherited value (default normal value is determined by the browser 1.0 to 1.2 as recommended by w3c).

  8. Dustin Diaz

    Oh my…
    Excuse the moderated comments. As many of you know, your comments will not be approved automatically unless you’ve posted at least once with a moderated comment. I suppose I will temporarily turn that feature off due to the small increase in numbers thus far.

  9. Effair | Billet | CSS Shorthand Guide

    […] el.com”>

    Entrée du weblog CSS Shorthand Guide Un guide des raccourcis CSS. Aurait pu s’appeller Comment sauver de la bande passante en écrivant mo […]

  10. jordan

    Thank you very much for all the answers. :)

    Now that I know this little trick, I’ll have to start implementing it.

  11. Maheshbabu.Interactive - Web Standards | Design | CSS | Ajax » Blog Archive » CSS Shorthand Guide

    […] ith examples for:-  Background Font Border Margin and Padding List-style Continue Reading       […]

  12. Geoff Moller » Blog Archive » CSS Shorthand Guide

    […] quo; Joel Does Web 2.0 - Marketroids, ATTACK! CSS Shorthand Guide www.dustindiaz.com This entry was posted on Monday, October 24th, […]

  13. Molly E. Holzschlag

    Nicely done, Dustin. Very useful. May I steal freely from it? Purely for education purposes. I couldn’t find the exactl CC license you’re using! :)

  14. Workalone » Blog Archive » CSS shorthand

    […] little help « Tractors CSS shorthand CSS Shorthand Guide This looks like a very useful round up of all the parameters for CSS chorthand decla […]

  15. jazzle

    Excellent, very useful. Thanks!

  16. Dave Child

    There are a few more shorthand properties available. The complete list is:

    margin
    padding
    border
    border-left
    border-right
    border-top
    border-bottom
    border-color
    border-style
    border-width
    list-style
    background
    font
    outline
    pause (only for aural)
    cue (only for aural)

  17. Shane Perran

    Question on shorthand regarding fonts.

    Is it possible to include color: when using font size and line-height in 1em/1.5em format?

    I have not been able to get this to work in any order.

    My apologies if this was covered in a comment I didn’t read through them.

    I have tried font:

    size/line-height color family
    size/line-height family color
    family color size/lineheight

    etc etc.

    Maybe I was doing something silly, just curious :)

  18. Ethan

    Shane: The color of text is not part of the “font” attributes (there is no “font-color”). Instead, you must set it in the “color” attribute, which prevents you from using it in this shorthand.

    font: bold 1em/1.2em georgia,"times new roman",serif;
    color: red;

  19. Roger Johansson

    I wrote a litte something about CSS shorthand some time ago: Efficient CSS with shorthand properties.

  20. .derkilicious » Blog Archive » links for 2005-10-24

    […] ts: liquid, fluid, elastic, flexible, jello… (tags: css webdesign stylesheets) CSS Shorthand Guide (tags: css tutorials webdesign shorthand) Design Shack - Inspirational CSS and […]

  21. earMight

    I wrote a script awhile back that lets you play around with CSS non-destuctively. It works in all browser, except the CSS readout only works in IE (for now). You can check it out at:
    Live Page Change.

  22. Dustin Diaz

    @Molly:
    Most likely It will become part of the creative commons lisencing like most of the other scripts I’ve written. This was in fact my first guide so if you know of a better lisence for tutorial / guides / reference material, please let me know.

    @Jazzle. Thanks. ‘preciate it :)

    @Dave There was a reason I didn’t cover things like border-top mainly because I didn’t exactly qualify them as shorthand. border is definitely a special case but I can see why you pointed it out. I could at the least just mention that they follow the same rules as ‘border’…that should be a good compromise.

    @Roger I ran into yours while doing some research. It was quite good in fact. One thing I wanted to duely note in this guide is the scenario’s of ‘not declaring’ certain values. Eg. “What if I leave out ‘bold’?” or “is border:dotted allowed?” It was those kind of quirks I wanted to cover in detail in which I had yet to find a resource for.

  23. Schulblog

    CSS Shorthand Guide

    sehr nette Referenz!

    ~/dustindiaz.com/

  24. dvdd127’s Blog » Blog Archive » CSS Shorthand Guide

    […] CSS shorthand property value. So let’s work together and put one together shall we? read more | digg story This entry was posted on Monday […]

  25. Ben Spicer

    Congrats on making the front page of Digg!

    Really handy guide, thanks :)

  26. Dustin Diaz

    @Ethan and Shane.
    Seeking to plug in a ‘color’ is totally a valid question. Simply because ‘color’ is not part of the ‘font’ group doesn’t mean it shouldn’t be included. The fact that ‘line-height’ is in font shorthand spec can make one assume that color would be too.

    So, by all means, that’s not a silly question… and there were times I wish it was included. I’m not exactly sure why it’s not since color really only seems to effect fonts. In some browsers color also effects things like <hr />, but that is so quirky who knows…

  27. Recupero. . . | Central Scrutinizer - [ il web in 218 comode rate ]

    […] 8212; marcorosè alle 23:39 . . . link di fine settimana: - Lo stile in sintesi: CSS Shorthand Guide. - Lulu, ovvero se non nano, ormai micro o medio publishing. - Il primo Guerre Stel […]

  28. Drew

    In regards to borders, when no color is specified, it applies color implicitly from either its own font color rule, or from a parent’s font color rule. If it is not set in any case, it defaults to black.

    Not very useful, just something I’ve noticed, and the author seemed miffed about.

  29. Dustin Diaz

    Drew. careful how you word your sentences. The author is right here. It’s my site. lol.

    Anyway, Thanks for the tip. I did in fact say “Let’s work together and put one (a guide) together shall we?”

    I’ll make a special note about declaring color. These were in fact the ‘quirks’ I was aiming after.

  30. Dustin Diaz

    Ok, I updated the guide to appropriately reflect Drew’s remarks on inherted border color.

  31. Leslie Franke » Blog Archive » CSS Shorthand Guide

    […] CSS Shorthand Guide Dustin Diaz has compiled a nice CSS shorthand property reference guide. This entry was posted on […]

  32. Lew

    Yeah this rocks, many thanks

  33. mildiez.net » Archivo de bitcora » CSS Shortland made easy

    […] rrollo web Con este ttulo tan funky-gipsy-fandangero quiero anunciar la gua definitiva para CSS shortla […]

  34. Oliver Siodmak’s Rants and Raves » Blog Archive » CSS Shorthand Guide

    […] g a great job capturing the various ways CSS instructions can be simplified. Checkout his CSS CSS Shorthand Guide for a wealth of information Reviewing his references both beginning web develop […]

  35. Take My Advice - I’m Not Using It! » Mix and Match

    […] uff, Photoshop, Other — Robin @ 9:18 pm Dustin Diaz has put together a very nice CSS Shorthand Guide. What’s nice about this guide is that it includes the default value for the […]

  36. Magic Sauce » CSS Shorthand Guide

    […] CSS Shorthand Guide October 25th, 2005 CSS shorthand property reference guide by Dustin Diaz Ok. Let’s set the record straight. There is no […]

  37. Nathan Smith

    Thanks for this writeup! I’ve been trying to get a few friends to make the switch from tables to CSS, but they’ve found the whole short-hand / long-hand thing too daunting of a task to learn. I think this will help convince them.

  38. Jason Beaird

    Great compilation Dustin. Bookmark’d! The one thing I always thought was screwy about background-position is that the order is X then Y. That seems to make sense…but when you do any of the 4 sided properties (border, margin, padding, etc.) you specify them clockwise from the top…with the short-hand being top-bottom left-right.

    OK, so the more I write, the less sense this is making but… background-position: 10px 50px; always gets confused with background-position: 50px 10px in my head because I think from top clockwise to bottom because of those 4 sided properties.

    Not saying it should be different. Just saying it often causes me 5-10sec. of grief when background’s show up all out of place. But then…I can’t even spell postion correctly half the time either.

  39. Dustin Diaz

    Jaso, Yea, that is funny. Especially since I usually always write background-position:top left it becomes confusing when you write the X/Y which would then change it to writing left top… either that or we both failed geometry.

  40. Recovery. . . | Central Scrutinizer (en. vers.)

    […] co Rosella at 1:30 am

    . . . of weekend’s links: - The syle in synthesis: CSS Shorthand Guide. - Lulu, not nano, but now micro or medium publishing. - First episode of Star Wars […]

  41. Ptchfork

    I can’t seem to get the certian things set on my page - I want the width of the center table to be greater & also I’d like to change the widths of the columns (make the topic longer & the started by & last post shorter. I think the problem is I need to define these settings, but I’m not sure how

    Any help would be great

  42. eisi

    hope you can add to the “margin fun” section the proper order for 4 values (top, right, bottom, left) so that your list becomes complete. ^^; cheers! lovely site.

  43. ram-online

    wow
    gotta love this css shorthand guide.
    something i’ve been waiting for…
    thanx a lot!

    hope your having a good time

    –rob

  44. position: absolute

    CSS Shorthand Guide

    Using CSS shorthands instead of the regular rules will help reduce the weight of your CSS files dramatically. Instead of writing bloated rules such as:
    element {
    background-color: red;
    background-repeat: no-repeat;
    background-image: url(image.pn…

  45. Common thoughts » Blog Archive » CSS shorthand guide!

    […] 217;s toes but there’s a great guide to CSS shorthand on Dustin Diaz’s blog at http://www.dustindiaz.com/css-shorthand/ For someone like me who doesn’t use CSS every day and th […]

  46. The Mainbrace » CSS Shorthand

    […]

    The Mainbrace

    blog

    CSS Shorthandin the wee hours

    http://www.dustindiaz.com/css-shorthand/ There is a PDF coming soon he says!

    […]

  47. Stuart Homfray

    Fantastic stuff, Dustin - extremely useful work!!

    One small thing (just to complicate matters slightly for those new to the CSS ‘game’) - don’t forget that web browsers have their own default stylesheets too!

    You might think that you’re getting a default value, but you end up getting a default browser value :)

  48. Benn Meyers

    I’d like to clarify something about the background function: background-attachment: fixed; sometimes does not work unless you’ve set a background-position: Xpx Ypx;

  49. Dustin Diaz

    Thanks Benn,
    I’ll make a note of it! I wouldn’t want to leave a quirk behind.

  50. Jérôme Bourreau-Guggenheim » Blog Archive » CSS Shortland Guide

    […] d Guide”> Un outil précieux dans l’arsenal du web developpeur. Lien : http://www.dustindiaz.com/css-shorthand/ Ce billet a été posté le […]

  51. Juglar :: Atributos de las hojas de estilo :: February :: 2005

    […] . Para fuentes. Equivalencias de las unidades de medida Chuleta imprimible atributos CSS CSS Shorthand Guide Ref: Desarrollo web Programacion.com HTML Help Manual CSS de Carlos Benavídez ASPT […]

  52. ifunky2

    ahh yes, great information.
    However the infamous Internet explorer the bane of all web coders,
    does have some serious CSS short handing incompetancies

  53. michael

    Just what I was looking for, thanks for publishing this.

  54. 250 rates collection: CSS | Central Scrutinizer - [ il web in 250 comode rate ]

    […] nti vari) Ten more CSS tricks you may not know How to size text using ems CSS Panic Guide CSS Shorthand Guide Ideas for a better form Caroline’s Corner: Registration Forms - what to do if […]

  55. onebc.net » Blog Archive » CSS shorthand guide!

    […] thand guide! There’s a great guide to CSS shorthand on Dustin Diaz’s blog at http://www.dustindiaz.com/css-shorthand/ I go through periods where my life seems to be CSS and therefor […]

  56. CSS Shorthand Reference Removed from Wikipedia

    […] guring that they could use a little help in this department, I decided to add a link to my CSS Shorthand Guide I wrote back in October of last year. I mea […]

  57. stephen

    Thanks for the guide. It’s an awsome read. It’s a life saver! I totally needed this.

  58. 250 rates collection: CSS | Central Scrutinizer (en. vers.)

    […] nti vari) Ten more CSS tricks you may not know How to size text using ems CSS Panic Guide CSS Shorthand Guide Ideas for a better form Caroline’s Corner: Registration Forms - what to do if […]

  59. Emil Stenström

    Hi! Great summary, it will be nice to show to beginners I meet. Well done

    (Sidenote: you have a typo under “the font shorthand property”, “inhert/” instead of “inherit/”)

  60. gilray4

    Nice post:
    But what about the most popular yet, “ Most inept browser ?”

  61. Dustin Diaz

    @Gilray4: Your example of demonstrating background’s in shorthand syntax are incorrect. you’re putting no-repeat directly after the url(). Try putting a space between the two and you’ll be good.

    Eg: background:url(img.png) top left no-repeat;

    That indeed works.

  62. gilray4

    Hey w00t, indeed it does:
    I was treating the closing “)” bracket like you have the semi colon. With no color stated you can put the “url” or anything for that matter adjacent to the semi colon, and I had assumed that was ok with the closing “)”, as long as any subsequent, shorthanded properties had the proper space between them.
    TY for looksee and reply, I’m glad to put that one to rest.

  63. gilray4

    Things that make you hmmm:
    So is that to say the fire fox is actually incorrect to render the image as centered, without the space?

  64. Christy

    I left a Question/comment last week. It’s gone and there’s been no reply!?? I found a VERY old paper with short hand on it and would like help in cracking the short hand code. PLEASE.

  65. Juglar :: Atributos de las hojas de estilo :: November :: 2005

    […] Desarrollo web Programacion.com HTML Help Manual CSS de Carlos Benavídez ASPTutor.com WebEstilo Menéame « Anterior: Del.icio.us Siguiente: Navegadores» […]

  66. edu.volpe.ch  •  CSS: Syntax

    […] CSS bietet auch einige Kurzschreibweisen zum Beispiel bei der Formatierung des Hintergrundes. Dadruch lässt sich ein CSS-Dokument ebenfalls übersichtlicher Gestalten und verkürzen. Interessante Beispiele für die Kurzschreibweise findet man im CSS Shorthand Guide von Dustin Diaz. […]

  67. Fatih Hayrioğlu’nun not defteri » CSS’de Kısaltmalar

    […] http://www.dustindiaz.com/css-shorthand/ […]

  68. Juglar :: Atributos de las hojas de estilo :: November :: 2004

    […] Desarrollo web Programacion.com HTML Help Manual CSS de Carlos Benavídez ASPTutor.com WebEstilo Menéame « Anterior: Definir estilos utilizando clases Siguiente: Agrupaciones de estilos» […]

  69. some guy

    i like the irreverent tone of the author’s original post. some people think CSS is a holy grail, passed down by the gods, but in reality it’s just another hack put together by fallible human beings.

  70. Dr. Web Weblog » Blog-Archiv » Cheat Sheet List - Spickzettel Sammlung

    […] CSS Shorthand Guide […]

  71. Terinea Tech Tips » Cheat Sheets

    […] CSS, yes really Jack Daniels (personally I recommend Talisker) : http://www.ilovejackdaniels.com/css/css-cheat-sheet/ | http://web.tampabay.rr.com/bmerkey/cheatsheet.htm | http://www.dustindiaz.com/css-shorthand/ […]

  72. rekkerd.org » archive » CSS techniques and general useful CSS information - royalty-free samples and audio software news

    […] Dustin Diaz’s CSS shorthand Guide is a wonderful collection of.. CSS shorthands (duh?!). Definately worth checking out. […]

  73. CSSElite CSS Gallery » CSS Shorthand

    […] A guide to css shorthand. Link […]

  74. Spellbook

    CSS Best Articles…

    [This post is constantly updated. Last Update - 06/09/2006]
    Articles

    CSS Frames v2, full-height
    Ten CSS tricks you may not know
    A List Apart: Multi-Column Lists
    Turning a list into a navigation bar
    How To Clear Floats Without Structural Markup
    A CSS s…

  75. i_design

    Nice work. Bookmarked for handy reference.

  76. On The Rocks :: Quick Reference :: October :: 2006

    […] CSS Shorthand Guide […]

  77. Minimizr » Blog Archive » Minimal CSS

    […] CSS Shorthand Guide […]

  78. » Cheat Sheet Round-Up: Ajax, CSS, LaTeX, Ruby… | Smashing Magazine | modern magazine for web-designers and developers

    […] CSS Shorthand Guide […]

  79. Ian Scott » Blog Archive » Cheat Sheet Round-Up: Ajax, Ruby, CSS, Apache, Blogging, Firefox, Google….

    […] CSS Shorthand Guide […]

  80. ty gossman

    Thanks for the reference Dustin, it is much appreciated.

  81. blog [dot] bigamp [dot] ca » Blog Archive » Blogroll Addition - ./with Imagination

    […] I just found the blog of Dustin Diaz via a posting at digg to one of his articles. Dustin is a User Interface Engineer for Yahoo! and has great information on his site about CSS, DOM JavaScript and a topping of XHTML too. The article in question is entitled CSS Shorthand Guide and although being over a year old now it is a great read and quick reference. […]

  82. Matt Wiebe

    Thanks for the shorthand reference. The font one has always confused me, and I hadn’t known about the font-size/line-height shorthand before. That’s definitely going to get some use from me!

    Also, a good acronym for remembering the margin shorthand is TRouBLe.

  83. Got an <idea>? » Blog Archive » Handboek voor CSS

    […] Hier te vinden […]

  84. arturo durán

    muchas gracias, es de mucha utilidad. arturo durán.

  85. CSS Required

    I’ve never heard of the outline CSS property before, can it be used in addition to the border property or does one replace the other?

  86. CSS Shorthand Guide « Georgia 4-H Technology Blog

    […] There is no official guide for each and every CSS shorthand property value. So let’s work together and put one together shall we? Ok. Straight to the business. Over the years, I’ve found quite some interesting unknown quirky facts about these shorthands… hence this Guide was born.read more | digg story […]

  87. links for 2006-11-24 « free/Hogg

    […] CSS Shorthand Guide (tags: css webdesign) […]

  88. Techhawking » Blog Archive » Thanksgiving updates

    […] During my work using CSS I found some interesing CSS tips and tricks sites. […]

  89. Prime News Blog » Blog Archive » CSS Shorthand Guide

    […] Ok. Let ’s set the record straight. There is no official guide for each and every CSS shorthand property value. So let’s work together and put one together shall we? Ok. Straight to the business. Over the years, I’ve found quite some interesting unknown quirky facts about these shorthands… hence this Guide was born.read more | digg story […]

  90. Webdesign

    wow
    gotta love this css shorthand guide.
    something i’ve been waiting for…
    thanx a lot!

    hope your having a good time

    –Japie

  91. Martini O’Clock » Blog Archive » links for 2006-11-24

    […] CSS Shorthand Guide A guide to CSS. (tags: css refererence shorthand design web) […]

  92. CSS Shorthand Guide « Next Generation Web

    […] read more | digg story […]

  93. Florin

    This is a very interesting article.
    I will use some of the features on my site.
    Thanks and congrats for this great work.

  94. timfitz.net » CSS Shorthand Guide

    […] read more | digg story […]

  95. Web Links 11.26.2006 « Rhonda Tipton’s WebLog

    […] Other Development CSS Shorthand Guide How to structure large CSS files Web development blogs you should read PowerShell Language Definitions for Notepad++ […]

  96. I Only Wish » Blog Archive » CSS Shorthand Guide

    […] read more | digg story […]

  97. Down10

    One more thing to add: the ‘border-width’ property, in addition to numbered values, allow for these extra values:

    thin/medium/thick

    with ‘medium’ being the default. (that might explain the default 3px value)

    (IMHO, I think they’re nonsense: Why not just use point values, like we’ve been doing for years in print? They’re just as scalable.

  98. Drainedge Link Tank » Today’s Links

    […] CSS Shorthand Guide […]

  99. The Web Design Blog

    […] A working guide to every CSS shorthand property value. « Web 2.0 style buttons   […]

  100. xocea » CSS Shorthand Guide

    […] Via Dustin diaz: Ok. Let’s set the record straight. There is no official guide for each and every CSS shorthand property value. So let’s work together and put one together shall we? Ok. Straight to the business. Anytime I’ve ran into a specification (besides the confusing mess at the W3C), it turns into showing off a couple of examples and you’re supposed to be set on your way. Well well. Over the years, I’ve found quite some interesting unknown quirky facts about these shorthands… hence this Guide was born. READ […]

  101. links for 2006-11-29 at James A. Arconati

    […] CSS Shorthand Guide Ok. Let’s set the record straight. There is no official guide for each and every CSS shorthand property value. So let’s work together and put one together shall we? Ok. Straight to the business. Anytime I’ve ran into a specification (besides the con (tags: web-developer fonts reference technology blogs web-developer/css) […]

  102. Jason

    I was taught long ago to remember the order of padding and spacing by the word “trouble”. ( Top, Right, Bottom, Left ).

    Just a little something that sticks in your head.

    HTH,
    Jason

  103. CSS Shorthand Guide / Web Words / WizarDev

    […] Read the Article… […]

  104. emo

    very useful guide. bookmarked! but dont have that much time to read. grrr. :(

    http://thygoodies.blogspot.com/

  105. il maistro » Hojas de referencia (php, ajax, css y más)

    […] CSS Shorthand Guide […]

  106. nur Bahnhof » CSS Shorthand Guide

    […] ~/dustindiaz.com/ […]

  107. Zoffix Znet

    Nice explanations.

  108. Ajax, CSS, LaTeX, Ruby : YaMTaR

    […] CSS Shorthand Guide […]

  109. Kwotem » CSS Shorthand Guide

    […] CSS Shorthand Guide […]

  110. links for 2007-02-03 « the adventures of a baby codemonkey

    […] CSS Shorthand Guide Ok. Let’s set the record straight. There is no official guide for each and every CSS shorthand property value. So let’s work together and put one together shall we? Ok. Straight to the business. Anytime I’ve ran into a specification (besides the con (tags: css design code) […]

  111. » The Developer Cheat Sheet Compilation by FuzzyOpinions.com

    […] CSS Shorthand Guide […]

  112. Snail Blog (beta) » 開発者に重宝なチートシート一覧

    […] CSS Shorthand Guide […]

  113. Ades Blog » CSS Cheat Sheet - all in one page

    […] Here is a similar CSS Shorthand Guide by Dustin Diaz. […]

  114. Introductory Class Blog » Blog Archive » CSS cheat sheet

    […] Another CSS Cheat Sheet […]

  115. Markus

    Interesting article! Good work!

  116. Cheat Sheet útiles « RinconXen

    […] CSS Shorthand Guide […]

  117. Reyvax’s Blog » Blog Archive » Css, la barbe :S

    […] CSS Shorthand Guide […]

  118. The Developer Cheat Sheet Compilation by Fuzzy Future

    […] CSS Shorthand Guide […]

  119. cheat sheet per tutti i gusti » Schiaccianoci’s WeBlog

    […] CSS Shorthand Guide […]

  120. Ashutosh Nilkanth’s Blog » Developer Cheat Sheets

    […] CSS Cheat Sheet CSS Shorthand Guide CSS Reference Sheet Javascript Cheat Sheet Javascript Quick Reference JQuery Cheat Sheet (PDF) JQuery Reference (PDF) […]

  121. The Developer Cheat Sheet Compilation by Fuzzy Future « Man on the moon

    […] CSS Shorthand Guide […]

  122. kork

    A working guide to every CSS shorthand property value. « Web 2.0 style buttons

  123. Cheat Sheets of all kind « ►

    […] CSS Shorthand Guide […]

  124. Ура « О PHP и о жизни…

    […] CSS Shorthand Guide […]

  125. Metayer.de Webmaster Blog » Blog Archive » Werbeagenturen haben keine Ahnung von HTML

    […] http://www.dustindiaz.com/css-shorthand/ […]

  126. pixelmeow

    Thank you SO much for this, maybe now I can get a better handle on CSS and finish my website redesign. :-)

  127. Site ekle

    Thank you very much for all the answers. :)

    Now that I know this little trick, I’ll have to start implementing it.

  128. Diyet Uzmani

    I’d like to clarify something about the background function: background-attachment: fixed; sometimes does not work unless you’ve set a background-position: Xpx Ypx;

  129. WD-NYC designer

    I appreciate your suggestions, it will definitely help me in the future.

  130. Gti Treffen

    I also start on working with CSS but it´s not that easy to learn and understand. but with a good book andmany examples I will get it working. do you know any good forums regarding CSS only?

    best regards
    Golf from GTI Treffen

  131. Dever

    I didn’t know about the list-style shorthand and the defaults if you’re not defining all the properties. Thanks for the info.

  132. Martin

    Hello
    This is a very interesting article.I will use some of the features on my site.
    Thanks and congrats for this great work

  133. billig reisen

    Fantastic stuff! thats i`m looked for the hole time. i have bookmarked this site now as one of my favourite resources for CSS. this great article its like my little css-bible for allways looking at then i`m stuck. thank you so much for sharing dustin.

  134. moda

    I also start on working with CSS but it´s not that easy to learn and understand. but with a good book andmany examples I will get it working. do you know any good forums regarding CSS only?

  135. Artem

    I put down the border color design on one of my blogs, it looks very good. But I have some misunderstanging with margin fun. Is evething ok with it?

  136. Afrika

    Hi, I just discovered your site - I think its very helpful, especially this CSS-Shorthand-Guide I like pretty much.
    Thanks for sharing knowledge and best regards from Germany

  137. Webdesign microdesign

    Great article. thanks for the big help! found this at google!

  138. sigarayı bırakmak

    very helpfull shorthands .I’ll use them

  139. Eddie Welker’s blog » Blog Archive » CSS Shorthand Cheat Sheet

    […] So the other day I was working on some boring CSS, and found myself having to look up ‘list-style’ for the millionth time. Just something about it that prevents me from remembering. So I looked over at my CSS cheat sheet, and it was absent. So I searched the webbernet for a cheat sheet. I found Dustin Diaz’s guide, but that wasn’t what I was looking for. It was full of information, however I know the values–I work with them every day. I just wanted a quick guide to figure out the order and defaults… that I can put on my wall. […]

  140. Site Ekle

    Other Development CSS Shorthand Guide How to structure large CSS files Web development blogs you should read PowerShell Language Definitions for Notepad++

  141. yks

    It’s very useful CSS resource. Thank you very much.

  142. yapı inşaat teklif

    I will use this type of CSS more often on my sites. Thanks for sharing.

  143. astroloji

    Thank you SO much for this, maybe now I can get a better handle on CSS and finish my website redesign.

  144. kadın

    number one web sites, thank you.

  145. Phil

    Mmm, shorthand. Lots of learning to do I think.

  146. Bidding Directory

    Thanks for this great tutorial it has come in handy and been a great help for me.

  147. daniel

    it’s a realy funny thing
    just have to look if it is valid ;)

  148. corlu

    very useful css informations thank you

  149. El mejor listado de Cheat Sheet (guias rapidas de comandos)

    […] CSS Shorthand Guide […]

  150. Vagabund

    Great Guide! Thank you.

  151. diziizle

    Thank you for the great article.But i couldnt figure out how to do the background thing :(

  152. Doontime - Freelance web designer » Blog Archive » Web Developer Toolbox

    […] CSS Shorthand Guide: A JavaScript, CSS, XHTML web log focusing on usability and accessibility. Check out this awesome tutorial compiled by Dustin Diaz’s. […]

  153. blog

    Thanks for the guide. It’s an awsome read. It’s a life saver! I totally needed this.

  154. Leticia

    I’ve translated your article to Portuguese.

    http://e.entao.com.br/2008/01/22/guia-de-abreviacoes-de-css.html

  155. baliwebdesigner

    damned you explain it in funny way :) but i love it, it more like hear your talking rather than reading your post. great!

  156. Bobbink SEO weblog

    Nice article! Can I translate and post in on my own blog?

  157. CSS Shorthand Notation « Blogs will be Blogs…

    […] I’m getting to work on this website overhaul. Great resource for keeping your code trim is this page here with lots of CSS shorthand notation […]

  158. Heroes

    wow.. thank you so much for the amazing article.

    you don’t know how much it help me with my forum.

  159. vicky

    why can’t i comment on this article?

    do i really need to be a blogger to be able to post?

  160. CSS Shorthand Guide | Fit Living Guide

    […] quite some interesting unknown quirky facts about these shorthands… hence this Guide was born.read more | digg story Filed under Blog by […]

  161. serin

    Great Guide! Thank you.

  162. Mark Baselier

    This guide was really interesting, thanks so much for the css information.

  163. Ingo

    Hi, I just discovered your site - I think it is very helpful, especially this CSS-Shorthand-Guide. I like it pretty much.
    Thanks for sharing knowledge and best regards from Germany

  164. Jesse

    Thanks so much! I am glad to find this site and it’s useful for cleaning up.

    Is there a shorthand for font color?
    font: bold 23px Arial, Helvetica, sans-serif;
    color: #000;

    I tried a few ways with the color before bold and after but no dice!

  165. Best Solution for Web :: 100 Essential Resources for Web Developers :: July :: 2008

    […] CSS Shorthand Guide: Check this out for Dustin Diaz’s tutorial on CSS […]

Leave a Reply

Phone Number:

If you're about to post code in your comment, please wrap your code with the tag-combo <pre><code>. Also please escape your html entities - otherwise they will be stripped out. I recommend using postable.

Get "JavaScript Design Patterns"

"As a web developer, you'll already know that JavaScript™ is a powerful language, allowing you to add an impressive array of dynamic functionality to otherwise static web sites. But there is more power waiting to be unlocked--JavaScript is capable of full object-oriented capabilities, and by applying OOP principles, best practices, and design patterns to your code, you can make it more powerful, more efficient, and easier to work with alone or as part of a team."

Buy JS Design Patterns from Amazon.com Buy JS Design Patterns from Apress

Flickr

Submit a Prototype

All content copyright © 2003 - 2007 under the Creative Commons License. Wanna know something? Just ask.

About | Archives | Blog Search

[x] close

Loading...

Submit a prototype

By checking this prototype I agree that I am not submitting false credentials, pornography, or a hate crime website. I also understand that by submitting my entry I may or may not be accepted, and if accepted, my entry may be taken down at any given time if I violate these terms.