CSS Mastery Tips
I just got a book called “CSS Mastery” by Andy Budd. It’s full of really great book on CSS practices for some of the more common things that programmers would want to do with CSS. It talks about layout, styling, advanced coding, it’s really worth the read to be sure.
This weeks CSS Tip:
One big issue with CSS has always been cross-browser control since you want everything to look the same in Internet Explorer as it does in Firefox or Safari or Opera. Ever notice how you can build a list, a table, or a paragraph and have it position completely different in Internet Explorer than it does it Firefox or Safari? One really interesting fix for this type of problem is to use the * in your stylesheet. The “*” when used at the top of a CSS document will effect all items in the XHTML document. So if you say:
* { margin:0; padding: 0;}
That would set all elements to have no margin and no padding… period. From there you can add padding and margins to your elements exactly how you wish which leaves very little room for interpretation from the browser itself. Remember, if you don’t specifically tell the browser what to do, you allow it a bit of room for it to do what it wants. In most cases that will be very inconsistent.