码迷,mamicode.com
首页 > Web开发 > 详细

css实现自适应宽度布局

时间:2015-08-01 18:34:07      阅读:115      评论:0      收藏:0      [点我收藏+]

标签:

1.实现左侧宽度固定,右侧全屏自适应。

body{margin:0;padding:0}
.wrap{ width:100%; float:left}
.content{ height:300px;background:green; margin-left:200px}
.right{ width:200px; height:300px; background:red; float:left; margin-left:-100%}

<body>
<div class="wrap">
    <div class="content">content</div>
</div>
<div class="right">aside</div>
</body>

 

2.实现左侧与右侧宽度固定,中间部分全屏自适应。

<style type="text/css">
body{margin:0;padding:0}
.wrap{ width:100%; float:left}
.content{ height:300px;background:green; margin-left:200px;margin-right:200px}
.left{ width:200px; height:300px; float:left; background:yellow; margin-left:-100%}
.right{ width:200px; height:300px; background:red; float:left; margin-left:-200px}
</style>

<body>
<div class="wrap">
    <div class="content">content</div>
</div>
<div class="left">aside</div>
<div class="right">aside</div>
</body>

 

css实现自适应宽度布局

标签:

原文地址:http://www.cnblogs.com/pengpenglin/p/4694420.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!