Topic: How to pass CSS class to a view output?

How can I pass a CCS class to this ouput ?

<%= store.address_line_1 %>

I tried several things like: <%= store.address_line_1, :class => :store_manager %>
but not working!

Re: How to pass CSS class to a view output?

I think you need to manually wrap it in a span tag?

<%= store.address_line_1 %> 
# renders in the browser => 123 Main St.

there is no 'tag' to add the css class to, so you need to add your html tags manually?

<span class="store_manager">
  <%= store.address_line_1 %>
</span> 
# renders in the browser => <span class="store_manager">123 Main St.</span>

Re: How to pass CSS class to a view output?

yes i just wanted to pass it in the code because my span class has assigned different values in my css and wanted something diferrent here and <span class="something> does not work cause i declared it in my body span above!

Re: How to pass CSS class to a view output?

I don't quite understand.
Are you saying that <span class="something"> does not work because you have a css definition for all span tags?

if so you should be able to override that definition, in your css if you have this

span {
  font-size: 10px;
}

you can still add more specific css class definition

span {
  font-size: 10px;
}

span.something {
  font-size: 16px;
}

Re: How to pass CSS class to a view output?

Oh! I wasn't aware of that!!
Thank you very much! smile