{"id":43,"date":"2005-02-09T14:20:16","date_gmt":"2005-02-09T19:20:16","guid":{"rendered":"http:\/\/www.killersites.com\/blog\/?p=43"},"modified":"2017-02-23T10:07:33","modified_gmt":"2017-02-23T15:07:33","slug":"css-hacks-are-stupid","status":"publish","type":"post","link":"https:\/\/www.killersites.com\/blog\/2005\/css-hacks-are-stupid\/","title":{"rendered":"Using CSS hacks is just plain stupid"},"content":{"rendered":"<p>The Web Standards movement has created a &#8216;culture of hacks&#8217; to compensate for browser incompatibilities (OK, mostly IE) and this is a bad idea.<\/p>\n<p>Before anyone attempts to tell me that the Web Standards community does not promote the use of hacks, please refer to just about every book written on <a target=\"_blank\" href=\"https:\/\/www.killersites.com\/blog\/2005\/css-books-outdated\/\">Web Standards based web design<\/a>.<\/p>\n<p><strong>Why were hacks promoted?<\/strong><\/p>\n<p><strong>In a nutshell:<\/strong> those who promoted them are inexperienced &#8230; in other words: green. It is simply bad practice to rely on broken aspects of a technology in an attempt to make things work &#8211; any programmer worth his salt knows this. And that is exactly what many\/most hacks rely on &#8211; broken aspects of Internet Explorer.<\/p>\n<p>&#8211;<br \/>\n<strong>Anecdote:<\/strong> I&#8217;ve often had to &#8216;slap-down&#8217; young-pup programmers (just a few years out of school,) when they&#8217;ve tried to introduce into the code base, what would be the equivalent of CSS hacks.<br \/>\n&#8211;<\/p>\n<p>CSS hacks are a recipe for disaster that I&#8217;ve been predicting for a while, a disaster that seems to be happening:  it looks as though <a target=\"_blank\" href=\"https:\/\/www.killersites.com\/blog\/2005\/ie7-breaks-common-css-hacks\/\">IE7 will be breaking CSS hacks<\/a> and thus, the <a target=\"_blank\" href=\"https:\/\/www.killersites.com\/blog\/2005\/web-standards-myths-debunked\/\">Web Standards myth of forward compatibility<\/a>.<\/p>\n<p><strong>I&#8217;ve used a hack:  I&#8217;m a god-curse hypocrite:<\/strong><\/p>\n<p>Yes, I&#8217;m guilty of &#8216;following the pack&#8217; and I&#8217;ve used a single CSS hack (child of div hack) but I used it in a minimal way &#8211;  should the hack fail (and it will in IE7,) my layouts will still work though the pixels will shift a little. <\/p>\n<p>The real problem occurs when you start using many hacks or if your hacks should fail, your website&#8217;s usability will be severely compromised. <\/p>\n<p>If you have to use hacks, use them very delicately.<\/p>\n<p><strong>The hack-free cross browser compatible solution:<\/strong><\/p>\n<p>When you&#8217;re critical of something, you should try to present alternatives &#8230; and my alternative to using brittle CSS hacks:<\/p>\n<p>Use a <a target=\"_blank\" href=\"http:\/\/www.killersites.com\/mvnforum\/mvnforum\/viewthread?thread=3151#15801\">IE conditional comments<\/a>, Microsoft intelligent solution to cross browser coding. <\/p>\n<p>I know, I know &#8230; Microsoft coming up with an intelligent solution!?<\/p>\n<p>\ud83d\ude42<\/p>\n<p>Stefan Mischook (a.k.a: The Web Design Heretic )<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The Web Standards movement has created a &#039;culture of hacks&#039; to compensate for browser incompatibilities (OK, mostly IE) and this is a bad idea.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/www.killersites.com\/blog\/wp-json\/wp\/v2\/posts\/43"}],"collection":[{"href":"https:\/\/www.killersites.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.killersites.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.killersites.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.killersites.com\/blog\/wp-json\/wp\/v2\/comments?post=43"}],"version-history":[{"count":2,"href":"https:\/\/www.killersites.com\/blog\/wp-json\/wp\/v2\/posts\/43\/revisions"}],"predecessor-version":[{"id":4782,"href":"https:\/\/www.killersites.com\/blog\/wp-json\/wp\/v2\/posts\/43\/revisions\/4782"}],"wp:attachment":[{"href":"https:\/\/www.killersites.com\/blog\/wp-json\/wp\/v2\/media?parent=43"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.killersites.com\/blog\/wp-json\/wp\/v2\/categories?post=43"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.killersites.com\/blog\/wp-json\/wp\/v2\/tags?post=43"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}