html - 使用 Bootstrap 设置 body 的最大宽度

标签 html twitter-bootstrap css

我正在使用 Twitter Bootstrap 构建我的第一个网站并尝试使用流畅的布局。我已将我的容器设置为流动的,现在里面的内容占据了整个页面宽度并随着我调整浏览器大小时进行调整。

我正在设计的最大宽度约为 950 像素。

我检查了 variables.lessresponsive.less,以及 Bootstrap 文档;我不太清楚如何做到这一点。

我还尝试将以下内容添加到我的 style.css:

body {
    max-width: 950px;
}

最佳答案

您不必通过删除 @media (max-width:1200px) 来修改 bootstrap-responsive ...

我的应用程序的 max-width 为 1600 像素。以下是它对我的作用:

  1. 创建 bootstrap-custom.css - 我尽可能不想覆盖我原来的 bootstrap css。

  2. 在 bootstrap-custom.css 中,通过包含以下代码覆盖容器流体:

像这样:

/* set a max-width for horizontal fluid layout and make it centered */
.container-fluid {
  margin-right: auto;
  margin-left: auto;
  max-width: 1600px; /* or 950px */
}

关于html - 使用 Bootstrap 设置 body 的最大宽度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9730263/

相关文章:

jquery - 动态添加类到Bootstrap的 'popover'容器

html - Twitter Bootstrap 透明 float CSS 问题 — 我做错了什么?

css - 即 11 : flex grow parent issue

css - 如果容器内部有 ul,如何使容器成为父容器的 100%

html - 将图标添加到 Bootstrap 下拉菜单

css - 语义 - CSS 不适用于移动 View

javascript - 有没有办法通过变量从对象中获取信息?

Android - WebView 中的图像不适合屏幕

html - 如何从下到上更改文本的背景颜色

javascript - 允许C#接受并处理POST请求