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

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
8c70506408fddb9740b4de7339055c77?d=identicon&s=25 Prashant Tiwari (tiwaripk)
on 2006-04-04 08:36
Hi,
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.
Prash
1aa112c30efa4109f938e7676c3808b6?d=identicon&s=25 Mats Lindblad (Guest)
on 2006-04-04 09:36
(Received via mailing list)
_______________________________________________
Rails mailing list
Rails@lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails
Ffc38459818ed3e1182553d45e6f2479?d=identicon&s=25 Gustav Paul (Guest)
on 2006-04-04 13:28
> =======
> < a href="goodbye.html" class="img">
> <%= link_to "GoodBye!", :action => "goodbye" %>
>
> ===
Try...

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

Braces are optional if all the following parameters are part of the
unbraced hash...in 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 Paul
gustav@psychohistorian.org
This topic is locked and can not be replied to.