Never been to CodeSnippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world (or not, you can keep them private!)

Clear Floats Without Structural Markup

This should allow you to clear floats in css, without adding extra elements. Add class="clearfix" to elements that need to be cleared. This should work in IE7 as well.

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

.clearfix {display:inline-block;}
/* Hide from IE Mac \*/
.clearfix {display:block;}
/* End hide from IE Mac */

Master CSS file for smart hack management

Using various hack management techniques publicized by Doug Bowman and Molly Holzschlag, this is the default stylesheet I <link /> to in the head of my markup:

/*
	[CLIENT] screen master
*/
@import url("core.css");

/* Import WinIEx-only bugs - hide from Mac IE5 \*/
@import url("hacks.win.iex.css");
/* END hide from Mac IE5 */

/*	Import Win IE5x hacks
	---------------------
*/

@media tty {
	i{content:"\";/*" "*/}} @import 'hacks.win.ie5.css'; /*";}
}/* */

/*	Import Mac IE5 hacks
	--------------------
*/

/*\*//*/
@import url("hacks.mac.ie5.css");
/**/


The core.css file contains my pure, "hack free" CSS. The other files referenced above contain any and all browser-specific hackery required to make <del>IE</del>lesser browsers behave properly.