Use css to automatically adapt images to size
Author:Eve Cole
Update Time:2009-06-12 17:47:59
The problem of images automatically adapting to size is a common problem during daily production. Here is a relatively simple solution:
div img {
max-width:600px;
//The maximum width under IE7, FF and other non-IE browsers is 600px;
width:600px;
//The size of the image in all browsers is 600px;
width:expression(document.body.clientWidth>600?"600px":"auto");
//When the image size is larger than 600px, it will automatically be reduced to 600px;
overflow:hidden;
}