CSS Best Practice #3: Clear Floated Containers (with Height||Width and Overflow)
I know you’ve done it before. I think we’ve all done it. You have a container with a floated element inside. The container doesn’t wrap around everything, thus causing the element to break outside of the container. To fix this, we’d usually add a clear element at the bottom of the container so it would [...]
CSS Best Practice #2: Shorthand Properties
Write your CSS rules with shorthand properties. It keeps things simple and clean. 1 2 3 4 5 6 7 8 9 10 .example { /* long */ padding-top:1px; padding-right:2px; padding-bottom:3px; padding-left:4px; /* short */ padding:1px 2px 3px 4px; } To help you with the shorthand, Dustin Diaz took the time to put together [...]
CSS Best Practice #1: Reset CSS
I think resetting browser styles is important. You’ll never know what you’re dealing with. If all the browsers start on the same page it will make your life easier because you’ll know what to expect. I personally use Eric Meyer’s Reset CSS as a base and modify it as needed.
CSS Best Practices: Index
I’ve decided to create an index of all the CSS best practices in this post that will be updated when I add a new best practice. It should be easier for you to keep track of everything. Please bear with me while I get things together.