用css让图片自动适应大小

Published by Sean_Loo at 2008-3-17 with 2 review(s), ? hits. [Articles]

图片自动适应大小的问题在平时制作的时候是比较常见的问题,下面提供一个比较简单的解决方法:

div img {
max-width:600px;
//IE7、FF等其他非IE浏览器下最大宽度为600px;
width:600px;
//所有浏览器中图片的大小为600px;
width:expression(document.body.clientWidth>600?"600px":"auto");
//当图片大小大于600px,自动缩小为600px;
overflow:hidden;
}
http://www.xvdesign.com/articles/expression.html
passn 2008-3-3
oh!is a nice site.. Quote
Sean_Loo 2008-3-3
[passn:oh!is a ni...]
2222
Quote



News and coming

Directories

抓虾 Rojo
google reader bloglines
my yahoo 哪吒

Resources

Status

  • []Writings
  • []Reviews
  • lx-super[A]163.comSean_Loo
鄂ICP备07004579号 Powered by Sean_Loo. All right reserved. W3CSitemap