Common CSS Mistakes
- Missing units. There are several units of linear measurement in CSS, one of the most common is pixels (px) which is the same unit of measurement that HTML attributes use.
- The z-index property only applies to elements with a 'position' property set to something other than 'static', which is the default.
- top,left,bottom, and right only apply to relatively or absolutely positioned elements.
- :link,:visited,:hover,:active should be used in that order.
- Font names that contain spaces should be quoted.
- position:relative moves the element from where it would normally render and leaves the space that it would normally occupy there.
- Forgetting to always specify a background color for a page. The background is usually white by default, but you can not rely on that.
- Guidelines about how to use CSS with XHTML and XML properly.
- Relative positioning should only be used to slightly adjust the position of elements, not to layout a page. Use floats, margins and, when needed, absolute positioning instead.
- Don't overuse absolute positioning.
- Placing @import rules where they aren't allowed. "CSS 2.1 user agents must ignore any '@import' rule that occurs inside a block or after any valid rule other than an @charset or an @import rule."