發現另外兩個方法都可以呢?
第一種方法,用float讓前兩個DIV一邊浮一個,最后一個寬度自適DIV它自己就會上去,然后給它設置個margin: 就可以了。
<!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" content="text/html; charset=utf-8" />
<title>無標題文檔</title>
<style type="text/css">
body{ margin:0; padding:0; }
.box{width:100%; background:#000;}
.box1{width:200px; background:#0F3; float:left; }
.box2{width:200px; background:#F00; float:right;}
.box3{ background:blue; margin:0px 200px;}
</style>
</head>
<body>
<div class="box">?
? ? ?<div class="box1">我是box1
文字文字文字文字文字文文字文字文字文文字文
</div>
? ? ?<div class="box2">我是box2
?文字文字文文字文字文文字文字文文文字文字文
</div>
? ? ?<div class="box3">文字文文字文字文文字文字文文字文字文文字文文字文字文字文字文文字文字文文字文字文文字文字文文字文字文文字文字文文字文字文文字文字文字文文字文字文字文
</div>
</div>
</body>
</html>
第二種和第一種差不多 把第3個DIV改為絕對定位。設置左右邊距就可以了。
<!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" content="text/html; charset=utf-8" />
<title>無標題文檔</title>
<style type="text/css">
body{ margin:0; padding:0; }
.box{width:100%; background:#000; position:relative;}
.box1{width:200px; background:#0F3; float:left; }
.box2{width:200px; background:#F00; float:right;}
.box3{ background:blue; position:absolute;left:200px;right:200px;}
</style>
</head>
<body>
<div class="box">?
? ? ?<div class="box1">我是box1
文字文字文字文字文字文文字文字文字文文字文
</div>
? ? ?<div class="box2">我是box2
?文字文字文文字文字文文字文字文文文字文字文
</div>
? ? ?<div class="box3">文字文文字文字文文字文字文文字文字文文字文文字文字文dsadsad字文dasdsadas字文文字文字文文字文dasdsa字文文字文字文文字文字dasddsa文文字文字文文字文字文文字文字文字文文字文字文字文
</div>
</div>
</body>
</html>
2016-05-22
所以你想問什么呢..達成一個效果確實不止一種方法阿