【问题标题】:Twitter bootstrap not displaying rightTwitter引导程序未正确显示
【发布时间】:2013-02-10 18:14:27
【问题描述】:

所以我正在寻找这个:http://twitter.github.com/bootstrap/base-css.html#forms 内联表单.form-inline

现在在我的页面上,输入看起来像没有填充一样:

现场示例:这里:http://jsbin.com/ariret/1/edit

这是我的代码:

      <div class="navbar">
        <div class="navbar-inner">
          <form class="form-inline" action="<?php echo $this->baseUrl('login'); ?>" id="form-login" method="post">
            <input type="text" class="input-small" id="email" name="email-login" placeholder="<?=$this->translate('Email');?>">
            <input type="password" class="input-small" id="password" name="password-login"  placeholder="<?=$this->translate('Password');?>">
            <label class="checkbox">
              <input type="checkbox" name="keep-logged" value="1" id="check-logged"> <?=$this->translate('Remember me'); ?>
            </label>
            <input type="hidden" name="login_type" value="normal" />
            <button type="submit" class="btn"><?=$this->translate('Login');?></button>
          </form>
        </div><!-- end navbar-iner -->
      </div><!-- end navbar -->

下面是它的样子:


它需要与登录按钮具有相同的高度。 我的页面中包含 css 和 js 文件!

【问题讨论】:

  • 您是否有任何自定义 CSS 会影响您的输入?仅查看 html 很难调试。指向您的项目的链接会很有帮助。
  • 好问题!这是重现问题的 jsbin 链接:jsbin.com/ariret/1/edit
  • @Jrod no,你可以在这里看到:jsbin.com/ariret/1/edit thx w0lf
  • 测试链接将有助于更好地帮助您。
  • @Shail 更新了我的帖子先生:jsbin.com/ariret/1/edit

标签: jquery html css twitter-bootstrap


【解决方案1】:

"它需要和登录按钮有相同的高度。我的页面中包含 css 和 js 文件!"

<button type="submit" class="btn btn-primary btn-mini">login</button>

将按钮的高度降低到(几乎)输入的高度

如果你想增加输入的高度来对齐按钮,我建议你在本地覆盖css

<style type="text/css">
.form-inline .input-small {
  height: 30px;
  margin-top: 3px;
}
</style>

两种“解决方案”都适用于 jsbin 示例 - http://jsbin.com/ariret/4/edit

【讨论】:

    【解决方案2】:

    这似乎是 Bootstrap 的 JSbin 错误。其他测试站点(和本地主机)显示它可以按预期工作。

    Bootstrap 将输入字段的高度设置为 20 像素,但尚未应用。答案尚不清楚,但您可以随时前往https://github.com/remy/jsbin/issues/new 并提交新问题。

    【讨论】:

    • 好吧,它只是删除了表单的marin-bottom,输入仍然没有改变!就像在引导页面示例中一样
    • 如果它需要这个类,它会显示在respective页面中
    • 嗯,看起来像下拉箭头,高度不对,twitter.github.com/bootstrap/components.html#buttonDropdowns.btn-small
    • 可能是 JSBin + Shadow DOM。
    • 这是一个jsbin问题..我们也可以使用form-inline创建表单
    【解决方案3】:

    您可以通过以下方式创建:

    Jsfiddle Working inline bootstrap form

    浏览器中的结果Jsfiddle in browser

    <div class="navbar">
            <div class="navbar-inner">
                <div class="container-fluid">
                    <div class="nav row-fluid">
    
                            <form class="form-inline pull-right">
                                <input type="text" placeholder="email or username" />
                                <input type="password" placeholder="password" />
                                <label class="checkbox">
              <input type="checkbox" name="keep-logged" value="1" id="check-logged"> <?=$this->translate('Remember me'); ?>
            </label>
            <input type="hidden" name="login_type" value="normal" />
                                <button type="submit" class="btn">login</button>
                            </form>
    
                    </div>
                </div>
            </div>
        </div>
    

    【讨论】:

      猜你喜欢
      • 2020-11-19
      • 2013-02-24
      • 2021-08-09
      • 2021-03-07
      • 1970-01-01
      • 1970-01-01
      • 2020-11-18
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多