【问题标题】:Adding a span to bootstrap label with rails?使用导轨向引导标签添加跨度?
【发布时间】:2016-03-03 06:03:46
【问题描述】:

如何将跨度添加到使用引导表单 rails gem 生成的引导表单标签。

这是我到目前为止没有运气的尝试:

= bootstrap_form_for resource, url: wizard_path, method: :put, layout: :horizontal do |form|

 = form.select :cover_type, form.object.cover_types, {include_blank: true, label: "Cover Type <span class=fa fa-question-circle hidden-lg hidden-md></span>".html_safe}

谢谢

【问题讨论】:

    标签: ruby-on-rails twitter-bootstrap bootstrap-form-helper


    【解决方案1】:

    这有什么问题吗?

    = bootstrap_form_for resource, url: wizard_path, method: :put, layout: :horizontal do |form|
      = form.label 
        Cover Type 
        %span.fa.fa-question-circle.hidden-lg.hidden-md
      = form.select :cover_type, form.object.cover_types, {include_blank: true}
    

    你为什么不把标签放在select元素之前?

    【讨论】:

    • 缩进在某处关闭,我目前无法为您测试。 . .尝试弄乱= form.label 行之后的行间距。也许检查 haml 文档。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多