css - 将 html 中的 Ruby block 添加到输入类 - Twitter Bootstrap

标签 css twitter-bootstrap

我正在尝试将一个 ruby​​ block 添加到 HTML 文件中的 span 类。

<%= f.label :email =>

div & span类如下:

<div class="input-prepend">
    <span class="add-on">
        <i class="icon-envelope"></i>
    </span>
    <input class="span" id="prependedInput" type="text" placeholder="">
</div>

我已将 ruby​​ block 放在输入类中:

<div class="input-prepend">
    <span class="add-on">
        <i class="icon-envelope"></i>
    </span>
    <input class="span <%= f.text_field :email %>" id="prependedInput" type="text" placeholder="">
</div>

我正在使用 Twitter Bootstrap,这是在 divs/spans/或输入标签中放置 ruby​​ block 的正确方法吗?

我想做的是在输入字段中添加一个图标。当我提交文本时,它确实有效。代码和实际对象看起来很奇怪。

最佳答案

我怀疑这可能是您想要的:

<div class="input-prepend">
  <span class="add-on"><i class="icon-envelope"></i></span>
  <%= f.text_field :email, :id => "prependedInput" %>
</div>

关于css - 将 html 中的 Ruby block 添加到输入类 - Twitter Bootstrap,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13958032/

相关文章:

html - 我该怎么做才能让这个丝带横幅的两侧不透明?

html - 当它们的宽度不适合它们的容器时,我如何垂直包装列?

javascript - 如何根据浏览器设备添加/删除html元素和内容?

html - 调整窗口大小时居中 Bootstrap Carousel 图像

css - 像乐谱一样灵活的图像缩放/拉伸(stretch)

php - Assets 加载未找到图像 - symfony2

html - 使用 twitter-bootstrap 下拉菜单作为容器

ruby-on-rails - 如何使用类自定义设计错误消息

css - Bootstrap 4 : Get full width dropdown of the main-menu container

html - 如何在 Bootstrap 中并排设置表单字段