|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14479
- 金币
- 2525
- 威望
- 1647
- 贡献
- 1473
|
以前的解决方法主要是利用js来实现,但用过的人都知道该办法有点繁琐。还有一种是在外部容器定义over-flow:hidden。但这种办法只会切割图片而不会自动适用。& B2 g1 F1 W" P4 ~$ g" _
关键在于:max-width:780px;以及下面那行。5 K! I1 Q* ~# n) e' U& B! X
固定像素适应: M2 m/ v5 F/ K6 \, I" e. k
4 F! F, D: X- @& `
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> 以下是引用片段:: l* P, B" n6 Z$ `8 u1 @4 v( i7 y
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
0 Q; m) ?4 t3 v& e' u) L<html xmlns="http://www.w3.org/1999/xhtml";> - F, O& ?9 Y( J5 r; O: M
<head>
6 U7 ?# p; C: W6 s0 l<meta http-equiv="Content-Type" c /> & v* H' R- y5 a4 L. s
<title>css2.0 VS ie</title> ! D/ Y1 T# B3 E, K+ k& ~1 @7 i) q
<style type="text/css">
3 U6 Z& j) B' S# v<!--
+ X% X; p2 I4 k J5 Hbody {
; J h* G/ Y* \+ ?; c% d+ n8 Ufont-size: 12px; 9 X, G/ L9 |7 a" x- C
text-align: center;
3 C! T4 A# I1 j4 N# a( Vmargin: 0px;
. \; ~) H. a! o# v4 Mpadding: 0px;
# N; F4 } Y6 w& u, {7 u5 O: B}
9 }& w* Z0 o) O+ E( w" C# _#pic{
! z- c0 M1 h3 U! \3 U5 V7 I3 N margin:0 auto; 0 p1 ?! r+ J( P8 R9 [4 |1 {$ j. I( g
width:800px;
$ n+ f! l: w/ S g9 i! \6 m6 ?% Z padding:0;
& w' L! i( y. g7 a' r border:1px solid #333;
h9 c& S9 L0 s4 G0 ` V }
! ^3 }# B9 _7 f7 w#pic img{ 6 m0 r, x5 o# c: i) i
max-width:780px; - P: f/ \) G" D' B) B; U
width:expression(document.body.clientWidth > 780? "780px": "auto" );
( V& m" t) U* g$ dborder:1px dashed #000; * z- a; u& ?- h/ f, S
}
N! H' h9 p& [/ ]' Y; Q* J-->
0 S( v- S" W& K) r, _</style>
- D% K. l/ d* E5 e7 f2 l</head>
! L% }1 \/ T( V3 W. C8 T% U, o<body>
# Q! u2 O" M" `: p<div id="pic">
$ @% R! C& K/ ~5 H' a3 D<img src=http://webclub.net.cn/images/Beijing2008/logo.gif>
( o' }; d# M5 I* ]</div> Z: ?1 Z! u" U8 j) }' l
</body> 8 Q. f& D+ @; e! u* W( ~- ~- o, [
</html> * n; F; `5 p0 e9 Z6 u7 c6 ]
4 o/ }" o Z( B' i0 E- v; ?5 D百分比适应:2 I+ }: V' D- A, {5 g% b Y8 f! q
以下是引用片段:+ x* C7 Z) @2 Y6 ^# j- _" W9 D
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";> : N6 f: e* W8 l/ x6 c
<html xmlns="http://www.w3.org/1999/xhtml";>
! Q+ ?- B/ W* a% \! e2 k<head>
9 u1 S7 }8 F- R! T<meta http-equiv="Content-Type" c /> ' v( d) J- B6 J& H* Y! K; s
<title>css2.0 VS ie</title>
4 ~+ l, X4 b1 ]; C- P) l<style type="text/css"> - y" V* ]8 Q& U" s9 q) I7 ~
<!-- k3 A/ D6 s8 I8 t. z
body { ( W$ ~6 {& e: V. {# j
font-size: 12px; + u- v4 ?2 j4 v9 K* f
text-align: center;
; R0 T' P; l' O J; ~5 o* O/ P. ~6 Xmargin: 0px; `5 k2 w% f! N; n! d' G
padding: 0px;
/ U, y2 q7 K( W+ ~$ v}
9 f0 R7 x5 |9 W. D% B$ q" U#pic{ $ ]" b3 P! W" b0 @/ L; E
margin:0 auto; : c9 o. |# q) F4 i/ c" S
width:800px;
; U. ] y l; T" W3 l. |0 H3 @' n padding:0;
, W5 h5 W6 _. S' @ border:1px solid #333; ) B9 u: ^' n- e; a" c
}
+ f. j( M, M& a9 ^! ~2 b/ e8 N& C( O#pic img{
$ V' ]$ j7 i; a) l max-width:780px; 1 f& }" a( h" l& @8 b" Z
width:expression(document.body.clientWidth>document.getElementById("pic").scrollWidth*9/10? "780px": "auto" );
) \0 M" ~/ P( Y6 d+ c! c9 w- d7 Q/ Bborder:1px dashed #000;
9 W# M5 j0 v3 q3 q# M1 M}
$ b _: p) a" |0 t$ A-->
( z+ l7 h4 a0 k& X2 K8 o* T</style> ; S/ h6 P; e' c) G! ~
</head>
$ v4 f: F9 ?5 b7 m<body> 2 b' `9 c9 r8 b1 ^; }% \& @* J
<div id="pic"> % w: C: O* U ~6 a
<img src=http://webclub.net.cn/images/Beijing2008/logo.gif>
7 n; D% s" r! `</div> ( F6 f0 N l) N7 g4 y
</body>
v! l L: T" d. T* V</html> |
|