关于圣杯布局
老师,这样写代码,做出来的是圣杯布局的效果吗?
<!DOCTYPE html>
<html>
<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">
<title>圣杯布局</title>
<style type="text/css">
body {
min-width: 550px;
}
/* #header {
text-align: center;
background-color: #f1f1f1;
}
#container {
padding-left: 200px;
padding-right: 150px;
}
#container .column {
float: left;
}
#center {
background-color: #ccc;
width: 100%;
}
#left {
position: relative;
background-color: yellow;
width: 200px;
margin-left: -100%;
right: 200px;
}
#right {
background-color: red;
width: 150px;
margin-right: -150px;
}
#footer {
text-align: center;
background-color: #f1f1f1;
} */
/* 手写 clearfix */
/* .clearfix:after {
content: '';
display: table;
clear: both;
} */
#header {
width: 100%;
text-align: center;
background-color: red;
}
#container {
display:flex;
}
#container #center {
width: 1000px;
text-align: center;
background-color: #f1f1f1;
}
#left,#right {
text-align: center;
background: yellow;
flex: 1;
}
#footer {
width: 100%;
text-align: center;
background-color: skyblue;
}
</style>
</head>
<body>
<div id="header">this is header</div>
<div id="container" class="clearfix">
<div id="left" class="column">this is left</div>
<div id="center" class="column">this is center</div>
<div id="right" class="column">this is right</div>
</div>
<div id="footer">this is footer</div>
</body>
</html>
4
收起
正在回答 回答被采纳积分+1
1回答
恭喜解决一个难题,获得1积分~
来为老师/同学的回答评分吧
0 星