浮动和margin负值 三列布局

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<style>
.left{position:relative;float:left;width:200px;height:500px;background-color:red}
.middle{float:left;width:100%;margin:0 -200px;height:500px;background-color:#c8dcf2;padding:0 200px;box-sizing: border-box}
.right{float:left;width:200px;height:500px;background-color:red}
</style>
</head>
<body>
<div class="main">
<div class="left"></div>
<div class="middle"></div>
<div class="right"></div>
</div>

</body>
</html>
posted @ 2018-08-28 16:24  —只小白  阅读(190)  评论(0编辑  收藏  举报