How to keep a checkbox and label on the same line in a Rails form?

后端 未结 14 1507
天涯浪人
天涯浪人 2021-02-03 17:34

What should I do to keep the label of a checkbox on the same line with the checkbox in a rails view containing a form?

Currently the label goes on the next line:

<
14条回答
  •  有刺的猬
    2021-02-03 17:58

    i had a similar problem the other day, im using twitter bootsrap, but im also using the simple_form gem. i had to fix that detail through css, here is my code:

    <%=f.input :status, :label => "Disponible?",  :as => :boolean, :label_html => { :class => "pull-left dispo" }%>
    

    css:

    .dispo{
        margin-right:10%;
    }
    pull-left{
        float:left;
    }
    

提交回复
热议问题