# How do I use CSS with a link\_to with multiple options?

**URL:** <https://www.ruby-forum.com/t/how-do-i-use-css-with-a-link-to-with-multiple-options/72261>\
**Category:** Rails\
**Created:** [October 16, 2006, 3:02am UTC](https://www.ruby-forum.com/t/how-do-i-use-css-with-a-link-to-with-multiple-options/72261 "2006-10-16T03:02:04Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![George](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/71e660/32.png) [@George](https://www.ruby-forum.com/u/George)\
**Post date:** [October 16, 2006, 3:02am UTC](https://www.ruby-forum.com/t/how-do-i-use-css-with-a-link-to-with-multiple-options/72261/1 "2006-10-16T03:02:04Z")

</div>

I’m trying to use a CSS class with a link\_to that has multiple options:

\<%= link\_to ‘Destroy’, { :action =\> ‘destroy’, :id =\> @category },  
{:class =\> ‘button’, :confirm =\> ‘Are you sure?’, :post =\> true} %\>

This one is working correctly:

\<%= link\_to ‘Edit’, {:action =\> ‘edit’, :id =\> @category}, :class =\>  
‘button’ %\>

Any ideas? Thanks

---

<div class="post-metadata">

**Author:** ![George](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/71e660/32.png) [@George](https://www.ruby-forum.com/u/George)\
**Post date:** [October 16, 2006, 4:48am UTC](https://www.ruby-forum.com/t/how-do-i-use-css-with-a-link-to-with-multiple-options/72261/2 "2006-10-16T04:48:54Z")

</div>

George wrote:

> I’m trying to use a CSS class with a link\_to that has multiple options:
> 
> \<%= link\_to ‘Destroy’, { :action =\> ‘destroy’, :id =\> @category },  
> {:class =\> ‘button’, :confirm =\> ‘Are you sure?’, :post =\> true} %\>

Seems to work for me. I tried the same and this is the resultant html  
fragment.  
[Edit](https://www.ruby-forum.com/something/edit)

---

<div class="post-metadata">

**Author:** ![George](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/71e660/32.png) [@George](https://www.ruby-forum.com/u/George)\
**Post date:** [October 16, 2006, 6:42am UTC](https://www.ruby-forum.com/t/how-do-i-use-css-with-a-link-to-with-multiple-options/72261/3 "2006-10-16T06:42:01Z")

</div>

Raja Venkataraman wrote:

> George wrote:
> 
> > I’m trying to use a CSS class with a link\_to that has multiple options:
> > 
> > \<%= link\_to ‘Destroy’, { :action =\> ‘destroy’, :id =\> @category },  
> > {:class =\> ‘button’, :confirm =\> ‘Are you sure?’, :post =\> true} %\>
> 
> Seems to work for me. I tried the same and this is the resultant html  
> fragment.  
> [Edit](https://www.ruby-forum.com/something/edit)

I guess it sorta works. The hover isn’t working. Also, some other  
attributes aren’t showing on the Destroy link. Here’s part of my CSS  
file:

a.button {  
background-color : #2B4B7D;  
color: White;  
border: 1px solid white;  
padding: 2px;  
text-decoration : none;  
font-size : small;  
}

a:hover.button {  
background-color : white;  
color: black;  
border: 1px solid black;  
padding: 0;  
text-decoration : none;  
}

a:link.button {  
background-color : #2B4B7D;  
color: White;  
border: 1px solid white;  
padding: 0;  
text-decoration : none;  
}
