How to Find CSS Hacks?

Ever wonder how people find their CSS hacks? No? Well I do.

They must sit at their computers typing in random stuff and abusing code, effectively torturing browsers into doing strange strange things. Maybe they construct programs that export malformed CSS so they can leave browsers stuggling night and day–possibly the system is rigged up to some sort of bell that makes a noise everytime a browser fudges something up. Maybe the reaction they get is similar to the little bell on a microwave: salivation, but instead over food, over code. Erm…anyway I found a hack by accident–this is probably how they find them.

I was trying out a couple of colours (for simplicity lets just say I was trying out the shades black and white) for fonts. I couldn’t remember the hexadecimal codes for them, so I just commented them out to see which was the best one:

.hack {

color: /* #ffffff */ /* #000000 */ #ff0000;

}

Obviously the class I was working on wasn’t called “hack” but that’s the sum of it. I found the nice shade (i.e. red[#ff0000]) but forgot to take out the commented shades. When I went to test the site on my variety of browsers IE 5.5 fudged it. The writing wasn’t red. I was seeing red. I didn’t know why it wasn’t working, but eventually found out it was the commenting to “fault”. Now if I had discovered that a while ago I could give it a name, but no doubt someone already has. Nice to accidently discover something though. Try it yourself–if you dare…

<style>

.hack {

color: /* #ffffff */ /* #000000 */ #ff0000;

}

</style>

 

<span class=”hack”>Hello World!</span>

I think I’ll start a trend for silly CSS blog post titles.