<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="UTF-8">
<title>已知宽高元素水平垂直居中</title>
<style>
*{
margin:0;
padding: 0;
}
.main{
padding: 0 100px;
}
.left{
float: left;
width:100px;
background: red;
margin-left: -100%;
position: relative;
left:-100px;
}
.center{
float: left;
width:100%;
background: blue;
/*margin: 0 100px;*/
}
.right{
float: left;
width:100px;
background: green;
margin-left: -100px;
position: relative;left:100px;
}
</style>
</head>
<body>
<div class="main">
<div class="center">center</div>
<div class="left">left</div>
<div class="right">right</div>
</div>
</body>
</html>