Today morning i noticed that my blog skin was totally upside down. No, i didn’t been attacked by an hacker.
In fact, the skin i am using wasn’t prepared for internet explorer. Because i normally use Firefox, i didn’t noticed.
So with a little bit off patience i opened the css file an tried to find the styles that needed to be changed. When i found them, i had to apply an css hack to work in both IE and Firefox.
The hack is simple. If you have the style:
.style{
margin:0;
}
and, in it’s context, works well in Firefox but not in Internet Explorer (or vice versa - this normally isn’t the case) we change the .style into the value that works good in internet explorer and create the a new style so it continues to work in Firefox:
/* Internet explorer applies this*/
.style{
margin:10px;
}
/* Firefox applies this*/
html>body .style {
margin:0;
}
If you have more styles, you can leave them in the original .style because firefox will apply them as well. You only need to override the styles that are changed.