Firefox CSS Background Rendering Bug

Monday, September 10th, 2007

Just stumbled upon this bugfix and thought I’d post my findings. I was trying to figure out why wouldn’t completely render page background-color on pages without scrollbars. For example:

ff1.jpg

Switching between different tabs would restore the background to its intended value (#887D75), but nothing else seemed to work ( even tried <div class="clear"></div> at the bottom of the page ) until I tried this :

body { position:absolute; top:0px; bottom:0px; left:0px; right:0px; }

Become a CSS god

Friday, May 11th, 2007

Smashing Magazine, which I had heretofore never heard of, has an excellent article called 70 Expert Ideas For Better CSS Coding. The post is full of a wide range of wonderful suggestions on how to get the most out of your -based designs, compiled from blog postings from other designers around the web. Every designer tends to have his or her own set of rules to go by when building a site or “chopping” a designers renderings into into XHTML/. I have my own, and you can see it by just viewing the source code on this site and checking out the here. However, it’s always great to see what other designers have come up with.

Some of the suggestions seem so obvious you wouldn’t think they would deserve a mention:

1 ID per page, many classes per page. “Check your IDs: Only one element in a document can have a certain value for the id attribute, while any number of elements can share the same class name. [..] Class and id names can only consist of the characters [A-Za-z0-9] and hyphen (-), and they cannot start with a hyphen or a digit (see CSS2 syntax and basic data types).” [Roger Johansson]

But some suggestions seem so obvious you wonder, “Why didn’t I think of that before?!?!?!”:

Organize your -styles, using master style sheets. “Organizing your helps with future maintainability of the site. Start with a master style sheet. Within this style sheet import your reset., global., flash. (if needed) and structure. and on occasion a typography style sheet.”

This is such a novel idea, but such a good one.

Many suggestions rely on versions of that aren’t supported in “major” , and some suggestions rely on hacks to get around browser inconsistencies. That being said, every coder, from beginner to expert, will find something valuable here. As for me, I am making it a point from now on to improve the organization of my code. Thanks Smashing Magazine!