Forum: Ruby on Rails How to apply class from Stylesheet to "link_to" element???

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Prashant T. (Guest)
on 2006-04-04 10:36
This is the "img" class for anchor element inside my stylesheet.
A.img:link {

	color: #ffffff;
	text-decoration: none;

A.img:visited {
	color: #ffffff;
	text-decoration: none;
I can easily apply this tag inside my html document as follows:-
< a href="goodbye.html" class="img">
Now I want to apply this stylesheet class (img) to following link_to tag
of rHtml. How to this??
<%= link_to "GoodBye!", :action => "goodbye" %>


Please help me .
Thanx in advance.
Mats L. (Guest)
on 2006-04-04 11:36
(Received via mailing list)
Rails mailing list
Gustav P. (Guest)
on 2006-04-04 15:28
> =======
> < a href="goodbye.html" class="img">
> <%= link_to "GoodBye!", :action => "goodbye" %>
> ===

<%= link_to "GoodBye!", {:action => 'goodbye'}, {:class => 'img'} %>

Braces are optional if all the following parameters are part of the
unbraced this case, :class doesn't belong in the same hash as
the url_for parameters, so you have to explicitly tell ERb where the
hashes start and end...

Hope it helps!

Gustav P.
This topic is locked and can not be replied to.