I love CSS

I finally got the strength to give IE6 even less attention than I usually do, off the back of a post from Roger Johansson. Because of this, I also feel confident that it’s acceptable to use techniques available to more advanced browsers. The idea that all websites should look the same in all browsers is unrealistic and inappropriate, so this has opened up a whole new world of CSS that I can now freely use, and I’ve found it really fun. For example, in older browsers, all my category and archive links in my “sidebar” will be white, but new-browser-users will be rewarded with easier differentiation between link colours with the following gem:


#menu > li li:nth-child(2n) a {
color:#656565;
}

And to tidy up the last paragraph margins and get rid of the unattractive superfluous margin, I can now use this and be safe in the knowledge that people who care about this sort of thing will be able to see/appreciate it:


#menu div.content p:last-child {
margin-bottom: 0;
}

I don’t know how some people can dislike CSS. It’s such an awesome way of working.

Enthusiasm fuelling this post brought to you by grape juice and vodka.

IE6 and PNG transparency

I personally don’t believe that technology and techniques that benefit both the user and the developer should be shunned just because the lion-share of users are still relying on older technology. PNG gives far better quality images, usually at a greatly reduced file size. It seems like a no-brainer. Except for the fact that IE6 doesn’t support transparency in PNGs.

There is an IE6 PNG fix on TwinHelix that I can only get to do half the job, which is really irritating. The technique makes the image render with transparency, but makes it expand to a somtimes arbitrary size with the dreaded red cross in the corner. Another problem with this is that it doesn’t allow you do position the image. I’m currently using a relatively verbose alternative, which essentially involves you emulating an img tag, but allows you to position your element. Hopefully some will find this helpful as I was racking my brains for something like this on my last project.