Internet Explorer CSS Hacks - Transparent PNG and Selectors

February 23rd, 2008 by Aaron

As a reference for myself, I wanted to jot these things down.

First off, lets look at some common css selectors - and how we can use them to identify styles for specific versions of IE. (Note: I am way not into using hacks such as broken comments, etc, in CSS. I’d rather write a selector)

IE 6 and below

* html {}

IE 7 and below

*:first-child+html {} * html {}

IE 7 only

*:first-child+html {}

IE 7 and modern browsers only

html>body {}

** I can’t tell you how many times I wished for the parent/child selector option in IE 6. I’ve written way too many ‘ul ul ul li ul’ type strings

Next, lets check out the behavior for transparent GIFs:

First off, use the conditional comment to bring in the stylesheet only when needed.


Then, the actual behavior:

* html img {
position:relative;
behavior: expression((this.runtimeStyle.behavior="none")&&(this.pngSet?this.pngSet=true:(this.nodeName == "IMG" && this.src.toLowerCase().indexOf('.png')>-1?(this.runtimeStyle.backgroundImage = "none",
this.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + this.src + "', sizingMethod='image')",
this.src = "transparent.gif"):(this.origBg = this.origBg? this.origBg :this.currentStyle.backgroundImage.toString().replace('url("','').replace('")',''),
this.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + this.origBg + "', sizingMethod='crop')",
this.runtimeStyle.backgroundImage = "none")),this.pngSet=true)
);
}

The original article (I’ll link it at the end) references HTML .png as well - but I don’t give my png files a class of png… so its not worth it.

At any rate, I’m referencing this article and that article. I just didn’t want them to go offline and not have a copy of them. ;)


Securing Wordpress - what my ‘oops’ reminded me

February 23rd, 2008 by Aaron

I don’t want to admit it - but I messed up. I didn’t patch wordpress - and I was a victim of one of the released wp exploits. How could you let this happen? you ask. Well, I was lazy. But let this be a lesson to ya - don’t forget - otherwise its a LOT harder to clean it up (it took me roughly 4 hours to fix which included 2 hours of ignoring my friend on the phone…)

For good measure, I’ll hook you up with some worthwhile links to help you secure your WP:

Main Article about Wordpress Security Tips and Hacks. He links to Three tips to protect your wordpress from matt and also wp designer’s tips on security. Oh and if you’re really gutzy - or lazy - check out the wp scanner - should help you take care of some stuff.

Don’t screw up like I did - lazy isn’t worth it! ;)


|
©2008 102 Degrees LLC - All Rights Reserved Home Services Products Network Blog Open Source Learning Contact