Luiz E.
Luiz E.

Reputation: 7229

content_tag generating weird html

I have this snippet in a presenter:

html << helpers.content_tag(:li, class: 'dropdown-header') do helpers.content_tag('span', "Status: #{online_srt}", class: 'glyphicon glyphicon-off') end and the generated html is this

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

which makes the output to look pretty weird

enter image description here

the 'Online' String has a lot of spaces after the 'Status', and this makes no sense. I think the ::before is the one responsible for this...what can I do to make the output be printed without this ::before?

Upvotes: 0

Views: 121

Answers (1)

mikdiet
mikdiet

Reputation: 10018

You have some pseudo-element, like .glyphicon:before in your css files.

Do you use twitter bootstrap? It suggest another way to use glyph icons. You need to put text after span tag, like

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

Upvotes: 1

Related Questions