在DIV下图片自适应的解决方法
以前的解决方法主要是利用js来实现,但用过的人都知道该办法有点繁琐。还有一种是在外部容器定义over-flow:hidden。但这种办法只会切割图片而不会自动适用。关键在于:max-width:780px;以及下面那行。)}0n [h_oI
[b]固定像素适应:[/b]
dotted; TABLE-LAYOUT: fixed; BORDER-TOP: #cccccc 1px dotted; BORDER-LEFT: #cccccc 1px dotted; BORDER-BOTTOM: #cccccc 1px dotted" cellSpacing=0 cellPadding=6 width="95%" align=center border=0> 以下是引用片段:&x0KEBNd)c
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";> -PF?+HP
<html xmlns="http://www.w3.org/1999/xhtml";> '}d"\ L:wn7x~ b
<head>
<meta http-equiv="Content-Type" c /> @ xD/B!Q'Cw3RGs']z$n
<title>css2.0 VS ie</title> fa%]q9V)]vZ8W b
<style type="text/css">
<!-- 6dv)Ov]2g?{ g(qT
body {
font-size: 12px; gZ+^:k t)i
text-align: center;
margin: 0px;
padding: 0px; eZ3@,w6C ].f-G8v,{W6X
}
#pic{ G SpvX2Q@a)F1["`
margin:0 auto; x0I,f/W'G3r Q\D
width:800px;
padding:0;
border:1px solid #333; Fz/UD B N
} %bM!F Wa
#pic img{ #l.mg\!B,g!G6V
max-width:780px;
width:expression(document.body.clientWidth > 780? "780px": "auto" );
border:1px dashed #000; $qAl+u+S7B+t7G
} *PLIO b |0c8MG
-->
</style>
</head> *e3vsp"@$E?9r
<body>
<div id="pic">
<img src=[url=http://webclub.net.cn/images/Beijing2008/logo.gif]http://webclub.net.cn/images/Beijing2008/logo.gif[/url]>
</div>
</body> }k^1T#h!`!S
</html> B2q%t2]:Mo0J
百分比适应:HMV!Vu+U3?
以下是引用片段:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";> s M}|c,zt/S*rL
<html xmlns="http://www.w3.org/1999/xhtml";>
<head>
<meta http-equiv="Content-Type" c /> r3O.BN%XF}?6F
<title>css2.0 VS ie</title>
<style type="text/css">
<!-- ){%M Y mi/T
body { x.P!sE VC0r
font-size: 12px;
text-align: center;
margin: 0px;
padding: 0px;
} #X-P'W*n4FmIk
#pic{
margin:0 auto;