开发者

Rails 3.1 simple_form submit style css

开发者 https://www.devze.com 2023-04-13 04:53 出处:网络
Hello did anybody know how to add a class to a simple_form submit button, for css style.Here\'s what I try to do:

Hello did anybody know how to add a class to a simple_form submit button, for css style.Here's what I try to do:

_form.html.erb

<%= simple_form_for(@drink) do |f| %>
 <%= f.submit "Add drink",:input_html =>{:class => "create"} %>
<%end%>

drinks.css.scss

.cr开发者_运维百科eate {
    background-color:#2fd62f;
    -moz-border-radius:4px;
    -webkit-border-radius:4px;
    border-radius:4px;
    border:1px solid #dcdcdc;
    display:inline-block;
    color:#fafafa;
    font-family:arial;
    font-size:12px;
    font-weight:bold;
    padding:7px 24px;
    text-decoration:none;
    text-shadow:0px 0px 0px #70706f;
}.create:hover {
    background-color:#2fbf0f;
}.create:active {
    position:relative;
    top:1px;
}   


<%= f.submit "Add drink", :class => "create" %>


In rails 5 do the following

<%= f.button :submit, "Add drink", class: "create" %>
0

精彩评论

暂无评论...
验证码 换一张
取 消