【问题标题】:bootstrap inline-append not working on the search formbootstrap inline-append 在搜索表单上不起作用
【发布时间】:2012-10-16 01:50:19
【问题描述】:

我正在尝试使用引导程序将按钮附加到搜索栏内,http://imgur.com/vUhXh 但它似乎不起作用。它正在 educomer.herokuapp.com 上显示,我使用的代码是

        %form.form-search
        .input-append
            %input.span3.search-query{:placeholder => "Search Food", :type => "text"}
            %button.btn{:type => "submit"}
                %span.icon-search

我尝试创建一个全新的应用程序只是为了查看我的代码是否存在问题,但这不是问题

【问题讨论】:

    标签: ruby-on-rails twitter-bootstrap haml


    【解决方案1】:

    您使用的是哪个版本的 Bootstrap?我在your Heroku site 中添加了以下内容:

    <div class="input-prepend">
      <span class="add-on">@</span><input class="span2" id="prependedInput" size="16" type="text" placeholder="Username">
    </div>
    <div class="input-append">
      <input class="span2" id="appendedInput" size="16" type="text"><span class="add-on">.00</span>
    </div>
    

    它按预期显示。 Bootstrap 的 changelog 说“支持 input-prepend/append 组件中的按钮”是在 2.0.2 版中添加的。

    【讨论】:

    • 我用的是2.1.0,是不是因为我用haml写了这段代码?当我用erb编写它时,它似乎也可以工作,有解决方法吗?
    • 我很奇怪它在 ERb 中对你有用,因为当我将你链接到的标记粘贴到 imgur.com 上时它对我不起作用。除非有多余的空格干扰,否则您使用 HAML 应该没有什么不同。
    • 啊,是的,看起来空格是问题所在。当我将 Bootstrap 示例站点中的标记更改为一行时,按钮移动到了字段旁边。尝试按照here 的描述添加 > 和
    猜你喜欢
    • 2014-10-01
    • 1970-01-01
    • 2016-03-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-09-02
    • 2011-11-30
    • 2020-07-06
    相关资源
    最近更新 更多