Tuesday, May 15, 2007

CSS Hack: IE and max-width

Firefox does max-width, IE doesn't. What's a developer to do when he or she wants to set a max-width on an image?

The very short answer:

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

The complete answer can be found here.

That's actually exceptionally cool that IE understands the expression statement in CSS. Seems like that could come in handy for all kinds of tricks.

No comments:

Post a Comment