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.
Prashant T. (Guest)
on 2006-04-04 10: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
Mats L. (Guest)
on 2006-04-04 11:36
(Received via mailing list)
_______________________________________________
Rails mailing list
removed_email_address@domain.invalid
http://lists.rubyonrails.org/mailman/listinfo/rails
Gustav P. (Guest)
on 2006-04-04 15: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 P.
removed_email_address@domain.invalid
This topic is locked and can not be replied to.