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:
- background-color
- background-image
- background-repeat
- background-attachment
- horizontal position
- 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