【问题标题】:Adding a bootstrap glyphicon to a button in rails将引导字形图标添加到rails中的按钮
【发布时间】:2016-02-10 22:38:11
【问题描述】:

我想在我目前使用 Rails 4.2.3 和 Ruby 2.2.0 的 Rails 应用程序的登录输入框中添加一个用户字形图标

我已经尝试搜索了很长一段时间,但还没有找到如何将其添加到 rails 应用程序,并且希望我的代码尽可能地保持 ruby​​ 并且如果可能的话(如果不是我想 html 就足够了但我很想学习如何在 Rails 语法中做到这一点。

任何帮助将不胜感激。

到目前为止,我的输入字段看起来像这样。

<div class="input-group input-group-lg">
    <%= f.label :email %><br />
    <%= f.email_field :email, autofocus: true %>
</div>

如果可能的话,我还希望字形出现在输入框的左侧,占位符出现在输入框的右侧。

【问题讨论】:

  • &lt;div class="glyphicon glyphicon-log-out"&gt;&lt;/div&gt; 将其用作注销
  • 只将其放在文本字段之外我正在寻找一种将其放置在文本字段内的方法。

标签: ruby html css ruby-on-rails-4 twitter-bootstrap-3


【解决方案1】:
<%= button_tag raw("<i class='srch-control-icon-srch'></i> search"), class: "button round" %>

【讨论】:

    【解决方案2】:

    HTML

    <div>
        <div class="input-group">
            <input type="text" class="form-control" placeholder="username" aria-describedby="basic-addon2"> <span class="input-group-addon" id="basic-addon2"> <span class="glyphicon glyphicon-log-out">
    
        </span></span>
        </div>
    </div>
    

    小提琴Here

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2015-08-28
      • 2013-07-30
      • 2015-10-17
      • 2015-12-29
      • 2014-06-12
      • 2012-05-04
      • 2020-10-14
      相关资源
      最近更新 更多