Max-width image solved for IE

I’m a Firefox user but that doesn’t matter. More than 80% of visitors use IE browser so when I tested my webpage in IE recently, the layout was out of places. That was due to the width of images that is larger than the width of post section. So I used max-width CSS attribute but it doesn’t work on IE. Luckily, I found this link that tells how to get around that.

.post-body img {
max-width:400px;
width: expression(this.width > 400 ? 400: true);
}

That’s all it takes to restrict images to a specific width for IE. Now my website is back in its proper layout.

Problem solved.

Tags: