在DIV下图片自适应的解决方法
以前的解决方法主要是利用js来实现,但用过的人都知道该办法有点繁琐。还有一种是在外部容器定义over-flow:hidden。但这种办法只会切割图片而不会自动适用。6W([rf3R)|\R:`#v6Z6T关键在于:max-width:780px;以及下面那行。.d%T$b3Ww/RJ
[b]固定像素适应:[/b]w D.g"F {W?+R
l8n7`AO+D"u*a4b
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> 以下是引用片段:*r;t K2E7t~"WXqS
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";> s1Y-B;hZ?E%]
<html xmlns="http://www.w3.org/1999/xhtml";>
<head> (Pu tI%i)n shL
<meta http-equiv="Content-Type" c />
<title>css2.0 VS ie</title>
<style type="text/css">
<!-- 2Z`,pq%oZ s
body { ~)TH!Pf:CR@I@_"t6y
font-size: 12px; 4}T%s+?up#K^
text-align: center; r w)q&bkK:s3{?(L
margin: 0px; M5R O%@!no
padding: 0px; 5A|/^+t&ap*C;H4w5Q
} iN l![!e\ w
#pic{
margin:0 auto; 4xlfbw
width:800px;
padding:0;
border:1px solid #333; W-|_1e~r;u@
}
#pic img{ #{1|;a J:f\W+Z
max-width:780px;
width:expression(document.body.clientWidth > 780? "780px": "auto" );
border:1px dashed #000;
} 1~@dHc&b
--> M9s3\5Y Iis
</style> RPDfT V
</head>