Changing Rails' Default link_to Text Color
When building Rails apps with OR without a framework like Bootstrap, any link_to text defaults to black.
For example, the words 'New Article' below appear black onscreen.
<%= link_to 'New Article', new_article_path' %>
That's fine if you want black text, but what if you want white text on a navy button, or something else?
The link_to helper can take a third argument, reserved for HTML options. Add a class: (any name you choose) or id: argument at the end of the example above:
<%= link_to 'New Article', new_article_path, class: 'link-to-text-color' %>
Now you can target this class (or id) in your CSS file as you would any other class (for example, change the text color to white):
.link-to-text-color { #fff; }
You can also use this same class (or id) to add padding, background-color or any other styles to your link_to text.
Remember that link_to actually renders an HTML anchor tag, so you may need to specify that in your CSS depending on your particular situation:
a.link-to-text-color { #fff; }