带Bootstrap 3的全宽和盒装宽度

时间:2014-10-28 16:23:49

标签: html css layout twitter-bootstrap-3

我要构建一个有2种布局的网站:装箱和全宽的Bootstrap 3.作为引导文档,我可以使用.container-fluid创建全宽布局,是不是?另外,我想知道创建盒装宽度布局的方式。预先感谢。抱歉英文不好。

2 个答案:

答案 0 :(得分:8)

使用.container作为响应式固定宽度容器。

<div class="container">
  ...
</div>

使用.container-fluid作为全宽容器,跨越视口的整个宽度。

<div class="container-fluid">
  ...
</div>

为什么要downvote?这是真的!!

http://getbootstrap.com/css/

答案 1 :(得分:0)

听起来您所指的解决方案将使用媒体查询指定容器宽度。

这样的事情应该适用于你所追求的目标:

/* Customize container */
@media (min-width: 960px) {
    .container {
        max-width: 780px;
    }
}

以上内容适用于您是否希望页面具有响应性(流畅)。如果您添加上述内容并从其页面添加默认模板,您应该会看到差异。希望这会有所帮助。

<!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">
    <title>Bootstrap 101 Template</title>

    <!-- Bootstrap -->
    <link href="css/bootstrap.min.css" 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.2/html5shiv.min.js"></script>
      <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
    <![endif]-->
  </head>
  <body>
    <h1>Hello, world!</h1>

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