今天做页面遇到,前面一个div固定宽度,后面填满横向宽度;搜索出来,应该还是非常有用处。
代码如下:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>div填充剩余宽度</title>
<style type="text/css">
div{
text-align:center;
color:white;
font-size:20px;
}
</style>
</head>
<body>
<div style="width:100%;">
<div style="width:150px;height:200px;line-height:200px;float:left;background:silver;">
第一个150px
</div>
<div style="width:250px;height:200px;line-height:200px;float:left;background:#c99;">
第二个250px
</div>
<div style="height:200px;line-height:200px;width:auto;background:orange;" >
第三个填充
</div>
</div>
<br>
<br>
<br>
<br>
<a href="http://bbs.csdn.net/topics/330134098">原文</a>
</body>
</html> 原文地址:http://blog.csdn.net/hgg923/article/details/42266355