Created
November 10, 2010 11:05
-
-
Save ogorzalka/670697 to your computer and use it in GitHub Desktop.
it's a fucking hack but it can be useful
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// maxheight + maxwidth | |
img { | |
/* For good browsers :) */ | |
max-height: 510px; | |
max-width: 510px; | |
/* Feed the devil :) */ | |
width: expression(this.offsetWidth>=this.offsetHeight?Math.min(500, this.offsetWidth) : 'auto'); | |
height: expression(this.offsetHeight>this.offsetWidth?Math.min(500, this.offsetHeight) : 'auto'); | |
} | |
// maxheight | |
img { | |
/* For good browsers :) */ | |
max-height: 500px; | |
/* Feed the devil :) */ | |
height: expression(this.height>510?500:true); | |
} | |
// width | |
img { | |
/* For good browsers :) */ | |
max-width: 500px; | |
/* Feed the devil :) */ | |
width: expression(this.width>510?500:true); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment