用margin實現兩列布局中的自適應列

zyip發表於2016-02-20

 

<div id="wrapper">
    <div id="col1">
      "fixed"
    </div>
    <div id="col2">
      "fluid"
    </div>
</div>

 

#wrapper{background:red;float:left;width:90%;height:200px;padding:5px}

#col1{
  float:left;
  width:100px;
  height:100%;
  background:green;
}
#col2{background:green;height:100%;margin-left:110px;margin-right:0px;}

 

http://jsfiddle.net/rhw0z1bj/

 

相關文章