高度和宽度自动适应的一个例子 2022-07-15 80酷酷网 80kuku.com HTML代码<head><title>test</title><meta http-equiv="Content-type" content="text/html; charset=gb2312"/><style type="text/css" media="screen">#outer{ display:table; width:100%;}#outer div{ display:table-cell;}#left{ background:#900; width:100px;}#center{ background:#CCC;}#right{ background:#369; width:200px;}</style><!--[if lt ie 7]><style type="text/css" media="screen">#outer{ display:block; position:relative; width:80%; background:#EEE;}#outer div{ display:block;}#left{ position:absolute; background:#900; top:0; left:0; width:100px;height:expression(outer.clientHeight+"px");}#center{ margin:0 200px 0 100px; background:#CCC;height:expression(Math.max(left.clientHeight,right.clientHeight)+"px");}#right{ position:absolute; top:0; right:0; background:#369;width:200px; height:expression(outer.clientHeight+"px");}</style><![endif]--></head><body> <div id="outer"> <div id="left">leftcolumn</div> <div id="center">center column</div><div id="right">right column right column right column rightcolumn right column right column right column right column right columnright column right column right column right column right column rightcolumn right column right column right column right column right columnright column right column right column right column right column rightcolumn right column right column right column right column rightcolumn</div> </div></body>