【问题标题】:content_tag generating weird htmlcontent_tag 生成奇怪的 html
【发布时间】:2014-10-13 19:30:28
【问题描述】:

我在演示者中有这个 sn-p:

html << helpers.content_tag(:li, class: 'dropdown-header') do helpers.content_tag('span', "Status: #{online_srt}", class: 'glyphicon glyphicon-off') end 生成的html是这样的

<li class="dropdown-header"> <span class="glyphicon glyphicon-off">::before Status: Online</span> </li>

这使得输出看起来很奇怪

“在线”字符串在“状态”之后有很多空格,这是没有意义的。我认为 ::before 是对此负责的人......我该怎么做才能在没有这个 ::before 的情况下打印输出?

【问题讨论】:

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


    【解决方案1】:

    您的 css 文件中有一些伪元素,例如 .glyphicon:before

    你使用 twitter 引导程序吗?它提出了另一种使用字形图标的方法。你需要在span标签后面加上文字,比如

    <li class="dropdown-header">
       <span class="glyphicon glyphicon-off"></span>Status: Online
    </li>
    

    【讨论】:

      猜你喜欢
      • 2015-02-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多