【问题标题】:Css class is not applying on buttonCSS类不适用于按钮
【发布时间】:2014-02-12 10:43:48
【问题描述】:

我在下面有一个按钮:

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

我正在申请 buttonhome 类,即下面

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

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

但它不适用于按钮。请建议我。等待回复。谢谢

【问题讨论】:

    标签: ruby-on-rails


    【解决方案1】:
    <%= button_to "Search", {action: "search"}, {class: 'buttonhome'} %>
    

    可能重复12

    【讨论】:

      【解决方案2】:

      试试

      div.button .buttonhome
      {
          height: 100px;
          width: 200px;
          font-family: Arial;
      
          background-color: transparent;
          border-style: none;
          font: white;
      }
      

      还要检查你的 css 是否加载正常,你的按钮是否有类 buttonhome。

      【讨论】:

        【解决方案3】:

        根据文档,html_option 是 button_to 的第三个参数

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

        所以用这个

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

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 2020-03-15
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2012-09-11
          • 1970-01-01
          • 1970-01-01
          相关资源
          最近更新 更多