圣杯布局min-width设置问题
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Document</title>
<style type="text/css">
body{
margin: 0;
padding: 0;
}
.header{
width: 100%;
height: 40px;
background: darkseagreen;
}
.container{
overflow: hidden;
padding: 0 200px;
min-width: 500px;
}
.middle,.left,.right{
float: left;
height: 200px;
position: relative;
}
.middle{
width: 100%;
background:deeppink;
}
.left{
width: 200px;
background: blue;
margin-left: -100%;
left: -200px;
}
.right{
width: 200px;
background: darkorchid;
margin-left: -200px;
right: -200px;
}
.footer{
width: 100%;
height: 30px;
background: darkslategray;
}
</style>
</head>
<body>
<div class="header">header内容区</div>
<div class="container">
<div class="middle">1.中间弹性区中间弹性区中间弹性区中间弹性区中间弹性区中间弹性区中间弹性区中间弹性区中间弹性区中间弹性区中间弹性区中间弹性区中间弹性区中间弹性区中间弹性区中间弹性区中间弹性区中间弹性区中间弹性区中间弹性区中间弹性区中间弹性区中间弹性区</div>
<div class="left">左边栏</div>
<div class="right">右边栏</div>
</div>
<div class="footer">footer内容区</div>
</body>
</html>老师我的代码min-width放在body不起作用,放在container才行,为什么?
19
收起
正在回答 回答被采纳积分+1
2回答
前端小白入门系列课程
- 参与学习 人
- 提交作业 11218 份
- 解答问题 36712 个
从一个不会编程的小白到一个老司机是需要过程的,首先得入门,学习基础知识,然后才能进阶,最后再到精通,本专题是你走进前端世界的不二选择!
了解课程
恭喜解决一个难题,获得1积分~
来为老师/同学的回答评分吧
0 星