以前的解决方法主要是利用js来实现,但用过的人都知道该办法有点繁琐。还有一种是在外部容器定义over-flow:hidden。但这种办法只会切割图片而不会自动适用。& J: @+ A8 k; @5 Z$ t& b
关键在于:max-width:780px;以及下面那行。. P; t G* j2 ]1 B 固定像素适应:8 C, H+ D! i5 e k
, E2 c2 e: m% N7 Q% @% _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> 以下是引用片段:* x' N% k6 B+ p0 A4 U8 z
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";> 7 `0 V6 n' W% g0 U5 V& j) U
<html xmlns="http://www.w3.org/1999/xhtml";> % Z# ~3 O# N6 _7 k; S<head> - i1 I1 M. m6 L
<meta http-equiv="Content-Type" c /> ) O4 U: a% U0 H0 Z) \: v) k3 B: z
<title>css2.0 VS ie</title> ! c5 g9 k" O9 z
<style type="text/css"> ! B4 s$ E% h. _1 j; f
<!-- 3 {( k% K' n+ s/ [' b! Lbody { , T) l. L+ C5 Y' \2 n) Dfont-size: 12px; % Q% G/ N6 \7 q% F' Z2 A! W
text-align: center; . e: S- \- ^4 D7 x9 B* v
margin: 0px; 7 ?% ^; S, p, u: Gpadding: 0px; / x* C' b7 w+ H4 J! H! ?- X
} # `4 d7 q1 ?' r5 p
#pic{ " ~! w N l6 I: m* a% G
margin:0 auto; + J% b9 R8 v& N( r( i o
width:800px; 8 c6 _- e9 P% i
padding:0; 4 ]7 O- n7 U5 ^: T border:1px solid #333; 8 Q5 d6 P' @' x1 W% F
} 4 x9 U) y7 s' [- x4 {9 i; B
#pic img{ : z( K! G- X) a8 y- V( S" z s5 F max-width:780px; : a+ d8 z% p0 O
width:expression(document.body.clientWidth > 780? "780px": "auto" ); , {$ e3 Q2 T$ D2 N- F# gborder:1px dashed #000; ) j h0 v+ ^8 |: Z
} . }( ` S- K* g0 h$ M6 M
--> , B! k. O6 D, n+ r2 [: G- h</style> " O& l3 ?" J+ b6 \
</head> * w' V- ~% s2 R
<body> 6 \ h* V0 N5 X# \4 G4 \. c
<div id="pic"> 5 t T9 ~5 P9 _<img src=http://webclub.net.cn/images/Beijing2008/logo.gif> " d6 l1 q3 r; D) _
</div> " S4 d4 A7 z; u% C3 B; T8 ~9 q
</body> 3 D: J/ Q/ o+ v2 [/ ^
</html> 5 J$ g Z/ H) b1 w4 T7 j/ F9 [