Cascading Style Sheets/Shorthand Properties

Class and ID Selectors

Use shorthand syntax for classes and longhand syntax for IDs to avoid setting unnecessary defaults and simplify debugging of dynamic class changes through scripting or property changes through pseudo-classes

Background Property Shorthand

When using shorthand to set all background properties in one declaration, use the following order for consistency and compatibility across browsers:

  1. background-color
  2. background-image
  3. background-repeat
  4. background-attachment
  5. horizontal position
  6. vertical position

Use background-image instead of the background shorthand when using ID selectors to avoid inadvertently overriding class-based background-position changes for CSS sprites

List-Style Shorthand

Use list-style shorthand instead of list-style-type for IE6 to avoid the declaration being ignored by the CSS parser


  This article uses material from the Wikipedia page available here. It is released under the Creative Commons Attribution-Share-Alike License 3.0.


Cascading_Style_Sheets/Shorthand_Properties
 

Manage research, learning and skills at IT1me. Create an account using LinkedIn to manage and organize your IT knowledge. IT1me works like a shopping cart for information -- helping you to save, discuss and share.


  Contact Us  |  About IT1me.com |  IT Training & References |  IT Careers |  IT Hardware |  IT Software |  IT Books