The Incident of the Hack Discovery Accident

August 14th, 2005

Ever wonder how the guys down at Position is Everything and sites by people like Tantek 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.

5 Responses to “The Incident of the Hack Discovery Accident”

  1. Pascal Says:
    August 15th, 2005 at 10:54 am

    Mhh, interesting, though I can’t see any applied uses apart from ‘confusing the Russians’. ;)

  2. Jen Says:
    August 17th, 2005 at 9:49 am

    It’s rather fun discovering such things by chance, even if I can’t quite grasp at the use of the ‘hack’. I must try it out when I find the time (because I dare!).

  3. Alex Says:
    August 17th, 2005 at 7:50 pm

    Oh you do, do you. ;) Heh, yeah, it was a nice surprise when I discovered it wasn’t my fault. :D

  4. Pascal Says:
    August 18th, 2005 at 7:52 am

    Damn I think that pun went by unnoticed. You do know what “confusing the Russians” meant?

    Ack… =\
    Cheers,
    Pascal

  5. Alex Says:
    August 25th, 2005 at 4:11 pm

    Erm, I laughed because it sounded funny. But no–I didn’t understand fully. Confusing Russians with English is easy though?–No?