首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >当我移出html页面时,我的wep页面会扩展怎么办?

当我移出html页面时,我的wep页面会扩展怎么办?
EN

Stack Overflow用户
提问于 2018-08-06 01:27:48
回答 1查看 0关注 0票数 0

这是我出现问题的网页的截图:https://i.stack.imgur.com/cjY2h.png

EN

回答 1

Stack Overflow用户

发布于 2018-08-06 10:40:57

这是因为你的内容在一个固定宽度的容器内。

HTML:

代码语言:txt
复制
<!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">
  <title>Document</title>
</head>
<body>
  <div class="bg">
    <div class="container">
      a
    </div>
  </div>
</body>
</html>

CSS:

代码语言:txt
复制
html, body {
  height: 100%;
  width: 100%;
  padding: 0;
  margin: 0;
}
.bg {
  background-color: red;
  height: 100%;
}
.container {
  width: 1000px;
  margin: auto;
  background-color: yellow;
}
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/-100001929

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档