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

css多列布局

时间:2017-11-06 19:08:21      阅读:172      评论:0      收藏:0      [点我收藏+]

标签:style   htm   技术   idt   png   效果   code   alt   image   

一、左侧定宽,右侧自适应

1. 使用float和margin实现

html

<div class="left">左侧定宽</div>
<div class="right">右侧自适应</div>

css

  .left{
    background-color: red;
    float: left;
    width: 300px;
    height:300px;
  }
  .right{
    background-color: green;
    margin-left: 300px;
    height:300px;
  }

效果图

技术分享

2. 使用float+margin(fix)实现

html

<div class="left">左侧定宽</div>
<div class="right-parent">
  <div class="right">
    利用float+margin(fix)实现
  </div>
</div>

css

  .left{
    background-color: red;
    float: left;
    width: 100px;
    height:300px;
  }
  .right-parent{
    float: right;
    margin-left: -100px;
    width: 100%;
  }
  .right{
    background-color: green;
    margin-left:100px;
    height:300px;
  }

 

css多列布局

标签:style   htm   技术   idt   png   效果   code   alt   image   

原文地址:http://www.cnblogs.com/Anita-meng/p/7794464.html

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