双飞翼布局和圣杯布局的结构相同,同样左右两栏固定,中间一栏自适应
前四步和圣杯布局相同

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel="stylesheet" href="练习.css">
<title>Document</title>
</head>
<body>
<div class="box">
<div class="center">
<div class="center-in">
</div>
</div>
<div class="left">1</div>
<div class="right">2</div>
</div>
</body>
</html>
.left,.right{
width:100px;
height: 100px;
background: red;
float: left;
}
.center{
width: 100%;
height: 100px;
background: blue;
float: left;
}
.box{
background: purple;
overflow: hidden;
}
.center-in{
margin: 0 100px;
height: 100px;
background: yellow;
}
.left{
margin-left: -100%;
}
.right{
margin-left: -100px;
}
我正在跟着江哥学编程,更多前端+区块链课程: www.it666.com
网友评论