【问题标题】:When viewing my twitter bootstrap site on a mobile a 20px gutter is added on the sides. How do I stop this?在移动设备上查看我的 twitter bootstrap 网站时,会在两侧添加 20px 的装订线。我该如何阻止这个?
【发布时间】:2013-09-07 06:25:56
【问题描述】:

在移动设备上查看我的 twitter bootstrap 网站时,每边都有 20px 的排水沟。这会阻止任何接触桌面边缘的内容在移动设备上这样做。在移动设备上查看时,twitter 引导主页本身没有这些排水沟。 http://twitter.github.com/bootstrap/

其他网站说放置正文 {padding-left:0;padding-right:0} 会有所帮助,但这会造成另一个问题,即弄乱导航栏。

有什么线索吗?

【问题讨论】:

标签: twitter-bootstrap


【解决方案1】:

尝试在 Bootstrap CSS 之后添加这个 CSS:

@media (max-width: 767px) {
  body {
    padding-right: 0;
    padding-left: 0;
  }
  .navbar-fixed-top,
  .navbar-fixed-bottom,
  .navbar-static-top {
    margin-right: 0;
    margin-left: 0;
  }
}

【讨论】:

  • @shim 不客气!请单击左侧的复选框轮廓将此答案标记为已接受的答案。
【解决方案2】:

上述答案并没有为我解决同样的问题......但确实让我找到了自己的解决方案

@media (max-width: 767px) {
    body {
        position: absolute;
    }
}

没有位置:绝对;在正文标签上,我最终会在 iPhone 等小屏幕上的文档右侧出现一个巨大的排水沟。但是当我添加 position:absolute;到 body 标签,我在大型桌面屏幕上得到相同的排水沟。把它放在上面的媒体查询中为我解决了这个问题。

我欢迎解释为什么会发生这种情况。

我使用的是 bootstrap 3.0 final

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2014-05-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-12-30
    • 2014-12-02
    • 2018-10-13
    相关资源
    最近更新 更多