CSS Hacks

CSS hacks are “techniques”, or as they are also known, “workaround”… to do some things work or being shown as we want in different browsers.
The biggest CSS’s enemy nowadays, is surely the Internet Explorer, from Microsoft. Although we fight agains some problems with others browsers too.
Let’s see now, some of these techniques that are NOT indicated at all, once future versions of brosers may “fix” them, and it makes your code NOT CSS VALID.
CSS Hacks are normaly based on bugs some interpreters have.
!ie: When rendering the page, our browser can accept the comand !IMPORTANT. But eventualy we can use a different identifier, which will make other browsers to NOT interpret the command. IE, in the other hand, does.
Then we can force a instruction to work only in Internet Explorer by using an invalid command after a “!”. To make it easier to notice, we use an IE commando.
Like this:

div
{
	border: dashed;
	border: solid !IE;
}

_property: The pattern our browser uses to understand an identifier waits it to begin with an alphanumeric character, otherwise, this commando will not be understood and will be skiped.
Of course, Internet Explorer behavior is different. This browser on its 6th verion or lower will work properly with these instructions.

div
{
	border: dashed;
	_border: solid;
}

*property: Since the 7th version of Internet Explorer, this problem has been fixed. But we still can use the “*” to make the trick.
Then:

div
{
	border: dashed; /* every browsers will understand */
	*border: solid; /* only for Internet Explorer, including 7+ */
	_border: solid; /* Only Internet Explorer lower or equal to 6 */
}

Please note that these implementations will make your code NOT VALID to W3C, then, use them moderately…only when really needed.
Personaly, I dislike its use. If the user’s browser does not know how to render a page… ask him to get a modern browser, like FireFox, Chrome, Safari or Opera.