CSS How to Tips

CSS Clearfix Best Cross browser solution

Clearing the divs has always been a solution for web 2.0 sites but there are many ways to implement it. The reason of this post is not to go in the details but giving a simple cross-browser css solution. BTW I prefer this css solution rather than adding the ugly empty clear div all over your html and polluting the markup.

Bad Solution :

<div style="clear:both"></div>

Perfect Cross Browser Solution:

add the css below to your site wide CSS file. and then apply the class clearfix to any containers that need to be cleared, or the containers in which you are adding the clear-div. and yes remove the clear-divĀ of-course.

.clearfix:after {
	content: ".";
	display: block;
	clear: both;
	visibility: hidden;
	line-height: 0;
	height: 0;

.clearfix {
	display: inline-block;

html[xmlns] .clearfix {
	display: block;

* html .clearfix {
	height: 1%;
	overflow: visible;
Code Javascript Tips

Analyzing your Javascripts performance

Gone are the days when your Javascript’s performance was no issue, developers used to show more love for their server than client’s browser, scripts used to delay the site loading times. There are many best practices for your JS code like having all your scripts at the bottom, etc. If you are looking for the best practices and approaches for you JS code then you should read Steve Souders, Douglas Crockford, Ben Cherry or google it.

But its not easy to remember all such best practices while you code…

what if you had a tool which would love to review your code and point out all the issues?

Yes this is very much possible, this fantastic tool called JSLint. They call it The Javascript code quality tool. and it is rightly so. You have to paste your JS code on the site and it’ll point out the issues, and guide you to improve the quality, hence improving the performance of you JS.