【问题标题】:How can I debug twitter bootstrap v4-alpha grid? col-sm-offset-* not working如何调试 twitter bootstrap v4-alpha 网格? col-sm-offset-* 不工作
【发布时间】:2016-07-03 15:38:40
【问题描述】:

我在某处改变了一些东西,现在col-sm-offset-*s 根本无法工作。例如,如果我想将屏幕一分为二,只在右侧显示内容,我通常会使用:

<div class="container">
    <div class="row">
        <div class="col-sm-6 col-sm-offset-6">
            This content isn't on the right hand side, it's on the left as if the col-sm-offset-6 isn't even there.
        </div>
    </div>
</div>

如何检查问题所在?

我正在使用 NPM 和 Laravel Elixir (gulp) 来缩小(准备好生产)文件,而且我没有在这里复制整个 CSS 文件,我不知道还能做什么。有什么明显的吗?有没有人遇到过这种情况?

更新

<div class="container">
    <div class="row">
        <div class="col-sm-6 col-sm-offset-6">
            <div class="row">
                <form role="form" method="POST" action="/register">
                    <input type="hidden" name="_token" value="abcdefghij">
                    <div class="col-xs-12">
                        <fieldset class="form-group">
                            <label for="username" class="form-control-label">Username</label>
                            <input name="username" type="text" class="form-control " id="username" placeholder="Enter a username" value="j">
                        </fieldset>
                    </div>
                    <div class="col-sm-6">
                        <fieldset class="form-group">
                            <label for="first_name" class="form-control-label">First Name</label>
                            <input name="first_name" type="text" class="form-control " id="first_name" placeholder="Enter your first name" value="John">
                        </fieldset>
                    </div>
                    <div class="col-sm-6">
                        <fieldset class="form-group">
                            <label for="last_name" class="form-control-label">Last Name</label>
                            <input name="last_name" type="text" class="form-control " id="last_name" placeholder="Enter your last name" value="Appleseed">
                        </fieldset>
                    </div>
                    <div class="col-sm-6">
                        <fieldset class="form-group">
                            <label for="email" class="form-control-label">Email Address</label>
                            <input name="email" type="email" class="form-control " id="email" placeholder="Enter your email address" value="j@a.com">
                        </fieldset>
                    </div>
                    <div class="col-sm-6">
                        <fieldset class="form-group">
                            <label for="password" class="form-control-label">Password</label>
                            <input name="password" type="password" class="form-control " id="password" placeholder="Enter a password" value="password">
                        </fieldset>
                    </div>
                    <div class="col-sm-6">
                        <fieldset class="form-group">
                            <label for="password_confirmation" class="form-control-label">Confirm Password</label>
                            <input name="password_confirmation" type="password" class="form-control " id="password_confirmation" placeholder="Please confirm your password" value="password">
                        </fieldset>
                    </div>
                    <div class="col-sm-6">
                        <div class="form-group">
                            <button type="submit" class="btn btn-primary pull-right">Register</button>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>

网页检查器

CSS 计算属性

更新 2

我已经提交了issue on GitHub,因为这可能是故意的。

【问题讨论】:

  • 标记works fine。在浏览器中按 F12 以查看哪些类正在应用于内部 div。
  • @Skelly 我已经更新了我的帖子。没有添加任何其他类,并且我已将我的 SCSS 文件剥离为通过 NPM 引入的非常基本的 v4-alpha-2 文件。不知道还要检查什么。
  • 当您在浏览器中检查偏移 div 时发生了什么?您应该看到 bootstrap.css 正在应用于它。该标记很有效,因此很可能与引导程序的包含方式有关。
  • 我再次更新了我的问题,其中包含来自网络检查器的几个屏幕截图。 col-sm-offset-6 属性中没有添加任何内容。
  • 故意的?我知道这是一项正在进行的工作,但他们should mention this change in the docs,因为我相信这会破坏很多网页。

标签: css twitter-bootstrap twitter-bootstrap-4


【解决方案1】:

GitHub 已正式更改其 col-bp-offset-* 名称,尽管文档目前已过时。

查看问题:#19099#19368#19267 和我自己的#19562

我将关闭问题并更新我的 GitHub 问题。

【讨论】:

    【解决方案2】:

    Bootstrap v4 Alpha 当前正确的偏移类:

     class="col-md-6 offset-md-3"
    

    【讨论】:

    • 只是我还是他们的current documentation 显示偏移量与版本 3 具有相同的语法?有点郁闷!
    • 是的,当前的 v4 文档在一些事情上是关闭的。如果文档中的内容不起作用,我也会查看源 CSS 文件以查找我正在寻找的内容。
    • 当你写下这个答案时,我立刻想到为什么我没有这样做 =.=
    猜你喜欢
    • 2021-07-02
    • 1970-01-01
    • 2017-01-14
    • 2013-08-11
    • 2019-09-17
    • 2023-03-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多