1

I have a button below:

<table align="center" width="50%">
<tr>
   <td style="color: #212121;">
    <div class="button">
         <%= button_to "Search", {:class => "buttonhome" } %>
    </div>
   </td>
</tr>
</table>

I am applying buttonhome class i.e below

.buttonhome
{
    height: 100px;
    width: 200px;
    font-family: Arial;

    background-color: transparent;
    border-style: none;
    font: white;
}

But its not applying on the button. Kindly suggest me. Waiting for reply. Thanks

3 Answers3

2
<%= button_to "Search", {action: "search"}, {class: 'buttonhome'} %>

possible duplicate 1 2

Community
  • 1
  • 1
Said Kaldybaev
  • 9,380
  • 8
  • 36
  • 53
0

Try

div.button .buttonhome
{
    height: 100px;
    width: 200px;
    font-family: Arial;

    background-color: transparent;
    border-style: none;
    font: white;
}

also check if your css is loading fine and your button has the class buttonhome.

Arun
  • 1,528
  • 3
  • 19
  • 34
0

The html_option is 3rd parameter of button_to according to documentation

http://apidock.com/rails/ActionView/Helpers/UrlHelper/button_to

so use this

<%= button_to 'Search', {}, { :class => "buttonhome" } %>
Dheer
  • 773
  • 1
  • 6
  • 16