html - adding a class to text displayed by rails in the view -
very straight forward..
how add class this
<h2><%= guide.title %></h2>
which displaying text?
you have wrap within container:
<div class="my_class"><%= guide.title %></div>
the container you'll use depends on context given text used.
update:
since text wrapped in <h2>
can do:
<h2 class='my_class'><%= guide.title %></h2>
another update:
if wan minimize amount of pure html in view, can do:
<%= content_tag :h2, class: 'my_class' %> <%= guide.title %> <% end %>
Comments
Post a Comment