首页 > 代码库 > CSS——实现两侧固定中间自适应的布局(PC)

CSS——实现两侧固定中间自适应的布局(PC)

<body>
  <div id="main">
    <div id="mainContainer">mainContainer</div>
  </div>
  <div id="left">
    <div id="leftContainer">leftContainer</div>
  </div>
  <div id="right">
    <div id="rightContainer">rightContainer</div>
  </div>
</body>

#main{width: 100%;float: left;background-color: purple;color: #ffffff;}


#mainContainer{height: 200px;margin:0 230px;}


#left{width: 230px;height: 200px;margin-left:-100%;float: left;background-color: orange;}


#right{width: 230px;height: 200px;margin-left: -230px;float: left;background-color: pink;}

CSS——实现两侧固定中间自适应的布局(PC)