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

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

thorough guide for profiling racket code -