# Options\_for\_select and setting css class values

**URL:** <https://www.ruby-forum.com/t/options-for-select-and-setting-css-class-values/104726>\
**Category:** Rails\
**Created:** [May 21, 2007, 10:46pm UTC](https://www.ruby-forum.com/t/options-for-select-and-setting-css-class-values/104726 "2007-05-21T22:46:09Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [May 21, 2007, 10:46pm UTC](https://www.ruby-forum.com/t/options-for-select-and-setting-css-class-values/104726/1 "2007-05-21T22:46:09Z")

</div>

Hi,

i’m not sure if this is possible using erb (at the very least, I can’t  
figure it out by googling or via searching this board), so here  
goes…

i’m using erb to make a select box with several hundred   
values

it looks something like this:

\<%= select\_tag ‘controls’, options\_for\_select(@controls.map {|cpd|  
["#{cpd.compound\_name}…#{cpd.trimmed\_number}"]}), {:class =\>  
‘superwide’, :size =\> 20} %\>

the above code works great…except for 1 thing.  
i’d like to cycle the color of every other tag using css.

obviously, i’d like to use the ‘cycle’ function, but how/where do i  
get options\_for\_select to accept a value for a css-class?  
e.g. :class =\> ‘blue\_text’

i’m not even sure if this is possible…

TIA!
