1

been trying to style my button_to button, however with no luck. I've had a look in the CSS file and used #button {color:red;}, button {color:red;} and .button {color:red;} but to no avail for all of them. I also have this in my HTML.ERB file <%= button_to 'Compare DB',:action => "compare", :id => 'button' but that doesn't help.

Is there any reason why that doesn't work?

The CSS stylesheet is linked to the Rails app, as I tried changing the value for the table so that's not the issue. Been trying for a while now, still can't figure out the solution.

1 Answer 1

2

You can use style inline

<%= button_to 'Compare DB',:action => "compare", :id => 'button', {:style => "background: color:red; } %> 

or you can use css clas like

<%= button_to 'Compare DB',:action => "compare", :id => 'button', {:class => "button"} %> 
Sign up to request clarification or add additional context in comments.

2 Comments

Nope that still doesn't work. I noticed my previous code works if there is no :action=>"compare". Very strange, I need to be able to change it as well though
Ok figured out the problem, I should have done like what you told me to do <%= button_to 'Compare DB',:action => "compare", :id => 'button', {:style => "background: color:red; } %>, paying close attention to the Brackets before style. Thanks

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.