Css style code
<Style type = "text/css">
Img {max-width: 500px; max-height: 500px; scale: expression (this. offsetWidth> this. offsetHeight )? (This. style. width = this. offsetWidth> = 500? "500px": "auto") :( this. style. height = this. offsetHeight> = 500? "500px": "auto"); display: inline! Important ;}
</Style>
In this example, all the img labels on the web page are scaled by default. If you want to scale a specific image, you only need to modify the css name and then call it on the web page.
For example, if you want to display a large image 1024*768 in a 100*100 container, you need to use the image scaling function at this time!
<Style type = "text/css">
Body {margin: 0; padding: 0 ;}
Img {
Border: none;
Max-width: 100px;/* FF IE7 */
Max-height: 100px;/* FF IE7 */
_ Width: expression (this. width> 100 & this. width> this. height? 100: auto);/* IE6 */
_ Height: expression (this. height> 100? 100: auto);/* IE6 */
}
</Style>
<Body> </body>
When scaling images and other ratios, you must align the bottom of the image. At this time, you can use absolute positioning!
When scaling an image to a specific column, you must center the image horizontally. In this case, you only need to add text-align: center; to the parent container!
The image scales proportionally and alignment at the bottom of the image. If you want to center the image horizontally, you can use table for the time being!