change color of links

I have the following code in one of my views

<div id="right" <%= link_to_remote( "#{l.name}", :update => "right", :url =>{ :action => :show_stats, :ladder_id => l.id }) %><br> </div>

I want to change the default color of the link from blue to white. I have tried using html_options like so

<%= link_to_remote( "#{l.name}", :update => "right", :url =>{ :action => :show_stats, :ladder_id => l.id }, :html_options => {:color => "white"}) %><br>

I have also tried wrapping the link_to in separate div tags and changing the color there, but none of this has worked. The links are still the default blue.

I am running rails 2.2.2

It looks like you have a broken div. Try this:

<div id="right">     <%= link_to_remote( "#{l.name}", :update => "right", :url => { :action => :show_stats, :ladder_id => l.id }) %> </div>

Then style it in the css with:

div#right a {color: #fff}

Matt

Try: <%= link_to_remote( “#{l.name}”, :update => “right”, :url =>{ :action => :show_stats, :ladder_id => l.id }, :html_options => {:style => “color:white”}) %>

This applies a style attribute to the link and the CSS then handles the color

You can’t wrap the call in divs because they won’t override a link’s color, that can only be done directly to the link.

@Matthew, The div tag is not broken, that was a typo on my part, sorry about that. Styling the div in the css does not work.

@Andrew I tried your syntax and that does not seem to change the link color either. I tried putting the link_to_remote both inside and outside div tags...no go.

Anybody else have any suggestions?

Sorry, another tired answer, try: <%= link_to_remote( “#{l.name}”, {:update => “right”, :url =>{ :action => :show_stats, :ladder_id => l.id }}, {:style => “color:white”} ) %>

The method signagure for link_to_remote is: link_to_remote(name, options = {}, html_options = nil)

so you need to include the display text, a hash of options for the remote link and then a second hash for the html specific options so it’s best to use explicit hashes so you know which is which

link_to_remote( name, {}, {} )