在DIV下图片自适应的解决方法
以前的解决方法主要是利用js来实现,但用过的人都知道该办法有点繁琐。还有一种是在外部容器定义over-flow:hidden。但这种办法只会切割图片而不会自动适用。~J5A fsx;T7K关键在于:max-width:780px;以及下面那行。m8RrG#Hu
[b]固定像素适应:[/b]6V4o|G YB-O_P;I;Bx
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> 以下是引用片段::s SJ1n\ y~
<!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" c /> (Y}7kJ#u3O
<title>css2.0 VS ie</title> S%Gq l"]b!l*u
<style type="text/css"> d'UR5bn;A uP
<!--
body {
font-size: 12px; ~!z,pw/t6{$k3YC#P
text-align: center; ~)VH(W.D
margin: 0px; $S!A LQFC(pO!TrKI;c
padding: 0px; 'G)Iq.`o @
}
#pic{
margin:0 auto;
width:800px; t ]5WBK+OO_/\x7K
padding:0; ISs Sz*oK
border:1px solid #333;
}
#pic img{
max-width:780px; _r.nvv4|
width:expression(document.body.clientWidth > 780? "780px": "auto" ); ,fY@c `q+Ayx
border:1px dashed #000; *DE[vX)O2g T:uC
} +~(p7}$eZ!N0?
--> w(gB+Z'W#c*KH@
</style> +W'@ u)c2Rv
</head> Oi3ps;D.t6g
<body> tJ Z?.f cF
<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> 1c6yX@4d ]5Y$Y
</html>
y(FQzt
百分比适应:KL| D!ss.n)s
以下是引用片段:
<!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";> W9|9wb+C!vk5coM
<head> XX8h^kK[
<meta http-equiv="Content-Type" c /> 6se$C s~s$L d5^ Q l
<title>css2.0 VS ie</title>
<style type="text/css"> tl(~!Bv4oC&c
<!--
body {
font-size: 12px;
text-align: center; 5V#I-|X4}au
margin: 0px; qyy[qGt%fb-E
padding: 0px;