Well the other day IE 7 was finally released to the public and as everyone was going crazy because they don’t know how to code without hacks, and havn’t tested their sites throughout the year or so of Release Candidates. All my sites were just fine pretty much and I never had a version prior to the public release but did view them on BrowserCam so I wasn’t to worried. The only sites that were not fine that I have done (Including this one), were the ones that all use the great ClearFix hack, which clears the nested floats inside of a container div.
I just started using this during the summer, before then I either floated the container divs or used a clearing div, which of course to the coding snobs is bad because of extra markup.
Here is the updated hack for any of you that were unaware of this:
.clearfix:after {
content: "."
display: block;
height: 0;
clear: both;
visibility: hidden;
}
.clearfix {display: inline-block;}
/* Hides from IE-mac */
* html .clearfix {height: 1%;}
.clearfix {display: block;}
/* End hide from IE-mac */
Place this in your CSS and then put the class “clearfix” on the container div that is holding the nested floats and there you go, no more clearing divs.
That was the only thing that was “Broken” on the sites that I have worked on. For all the people that are so scared of IE 7 and bashing how bad it is, all I have to say is that it is 10 times better then IE 6 and hopefully this means soon IE 5.5 will get out of the picture and we won’t have to use the box model hack anymore.Boy oh Boy I can’t wait till we can start using ” Attribute Selectors“, That is going to change CSS a lot, but I will get more into that in another article.
Well for all the people that used others layouts, and cluttered their code full of hacks I hope you knew to start testing and fixing a while back because soon Microsoft will be forcing its users with a critical update that will install IE 7.