移动视图中的对象居中 Bootstrap 失败

Centering objects in mobile view Bootstrap failed

我在为客户创建一个非常简单的 "under construction" 网站时遇到了问题。我正在使用 Bootstrap 进行响应。但是现在在 1024px 的宽度下,内容没有居中。

这是我使用的代码:

HTML

    <!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
    <title>Bootstrap 101 Template</title>

    <!-- Bootstrap -->
    <link href="css/bootstrap.css" rel="stylesheet">
    <link href="https://fonts.googleapis.com/css?family=Pacifico" rel="stylesheet"> 

    <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
      <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
      <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
    <![endif]-->
  </head>
  <body>
    <div id="logo">

      <a href="#">
      <img id="logo_img" src="img/logo.png">
    </a>

  </div>
  <div id="underc">
    <p>Under Construction</p>
  </div>
  <div id="underline">
  </div>
  <div id="social_media">

      <a href="">
    <img id="fb" src="img/facebook.png">
      </a>
      <a href="">
    <img id="tw" src="img/twitter.png">
    </a>
      <a href="">
    <img id="ig" src="img/instagram.png">
  </a>

  </div>

    <!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
    <!-- Include all compiled plugins (below), or include individual files as needed -->
    <script src="js/bootstrap.min.js"></script>
  </body>
</html>

CSS

    body {
      margin: 0;
      background-image: url("../img/background2.jpg");
      /* Set rules to fill background */
      min-height: 100%;
      min-width: 1024px;

      /* Set up proportionate scaling */
      width: 100%;
      height: auto;

      /* Set up positioning */
      position: fixed;
      top: 0;
      left: 0;
    }




#underline {
  height: 5px;
  background-color: #f57300;
  margin-bottom: 5px;
  margin-top: -20px;
  width: 800px;
  margin: 0 auto;
}
#logo {
  padding-top: 220px;
  height: 100px;
  width: auto;
  text-align: center;
}
#logo_img {
  height: 250px;
}
#underc {
  color: #f57300;
  text-align: center;
  padding-top: 275px;
  font-family: 'Pacifico', cursive;
  font-size: 80px;
}
#social_media {
padding-top: 10px;
text-align: center;
}
#fb {
  height: 30px;
}
#tw {
  height: 30px;
}
#ig {
  height: 30px;
}
@media (max-width: 700px) {
  #underline {
  height: 5px;
  background-color: #f57300;
  margin-bottom: 5px;
  margin-top: -20px;
  width: 600px;
  margin: 0 auto;
}
#logo {
  padding-top: 220px;
  height: 100px;
  text-align: center;
}
#logo_img {
  height: 150px;
  text-align: center;
}
#underc {
  color: #f57300;
  text-align: center;
  padding-top: 275px;
  font-family: 'Pacifico', cursive;
  font-size: 30px;
}
#social_media {
padding-top: 10px;
text-align: center;
}
#fb {
  height: 30px;
}
#tw {
  height: 30px;
}
#ig {
  height: 30px;

}

}

然而,当屏幕在某个阶段达到 "smaller" 时,它开始停留在页面的右侧并且不居中。

屏幕截图:

body 有最小宽度 属性

min-width: 1024px;

删除 属性 或使用 media queries 在不同屏幕上显示不同尺寸。