慕课网上底部footer部分,container使用margin:0 auto居中,现有缩小屏幕时的疑问

1.慕课网footer部分,container使用margin:0 auto居中,现在有缩小屏幕时候的疑问
2.相关代码如下:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <style>
        *{
            margin: 0px;
            padding: 0px;
        }
        body{
            overflow:visible;
        }
        .demo-wrapped{
            width: 1202px;
            height: 400px;
            margin: 0 auto;
            text-align: center;
        }
        .demo-header{
            background: blue;
        }
        .box{
            text-align: right;
            background: orange;
        }
        .box img{
            width: 300px;
            height: 300px;
        }
    </style>
</head>
<body>
    <div class="demo-header">
        <div class="demo-wrapped">
            <div class="box">
                <img src="images/300.png" alt="">
                <img src="images/300.png" alt="">
                <img src="images/300.png" alt="">
            </div>
        </div>
    </div>
</body>
</html>

3.疑问:
width:定值;margin:0 auto;当屏幕变小,body的宽度也随之变小,此时margin将变负值
4.图片如下所示

clipboard.pnghttps://segmentfault.com/img/...

5.慕课网的footer的container部分margin却没有负值,一直都保持margin-left和margin-right都是24px,这是为什么啊?

阅读 2.9k
1 个回答

因为 body: min-width: 1200px;

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题