css防止图片过大撑破盒子 兼容 ie6、 ie7、 ie8、 ff

来源:互联网 发布:安卓版windows模拟器 编辑:程序博客网 时间:2024/05/17 09:16
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>99乐活网-企业中心-天使体验</title>
<style type="text/css">
img,a img{
border:0;
margin:0;
padding:0;
max-width:650px;
width: expresion(onload=function(){this.style.width=(this.offsetWidth > 650)?"650px":"auto"}); /* 控制图片宽度,图片大于650时,图片宽度改为650,小于时宽度原大小*/
max-height:1650px;
height: expresion(this.height > 1650 ? 1650px : 'auto';);
}

</style>

<body>

<div>

<img src="图片路径" boder="0" />


</div>

<body><html>