DIV CSS adaptive width:
<!DOCTYPE html/><html><head><title>自适应宽度实例--www.ops.cc</title><style type="text/css">/* 自适应宽度 */#left{width:150px;margin-right:-150px;float:left;}#center{width:auto;margin:0 0 0 150px;}#right{width:140px;margin-left:-140px;float:right;}/* 自适应高度度 *//* warp 用于隐藏溢出的部分 */#wrap{overflow:hidden;}#left,#center,#right{padding-bottom:20000px;margin-bottom:-20000px;}</style></head><body><div id="wrap"><div id="left" style="background:#333;height:600px;">左边栏,固定宽度150px;高度600px</div><div id="right" style="background:#555">右边栏,固定宽度150px;高度:自适应</div><div id="center" style="background:#888">中间栏,宽度:自适应,高度:自适应</div></div></body></html>
1. Note that when adapting to the width, arrange the left and right columns first and then let the middle column Arrange freely, so the order of
2. The automatic height will Override the margin-bottom attribute of the div when both automatic width and automatic height are used. Preferably auto-height styles should come after auto-width.
#sidebar { width:auto; float:left;margin:0 762px 0 0;}
#main{width:742px;float:right;margin-left:-762px}
Please indicate the source for the original reprint of the article: http://newmin.cnblogs.com/archive/2010/11/04/div-css-auto-width-and-height.html