对齐“记住我”和复选框在同一行(CSS问题与Devise) [英] Align "Remember Me" and Check Box in same line (CSS issue with Devise)

查看:434
本文介绍了对齐“记住我”和复选框在同一行(CSS问题与Devise)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Devise with和复选框在记住我下面。以下是jsfiddle的HTML代码 http://jsfiddle.net/icyborg7/8zxyz/

I am using Devise with and the checkbox is below the Remember Me. Here is the HTML code on jsfiddle http://jsfiddle.net/icyborg7/8zxyz/

这是标准的设计代码

 <%= f.input :email %>
 <%= f.input :password %>
 <%= f.input  :remember_me, :as => :boolean if devise_mapping.rememberable? %>     
 <%= f.button :submit, "Sign In", :class => "btn-info btn" %>

这是HTML输出(粘贴在SO上)

This is the HTML output (Pasting it on SO too)

<div class="control-group boolean optional">
<label class="boolean optional control-label" for="user_remember_me">Remember me</label>
<div class="controls"><input name="user[remember_me]" type="hidden" value="0">
<label class="checkbox"><input class="boolean optional" 
id="user_remember_me" name="user[remember_me]" type="checkbox" value="1"></label>
</div>
</div>


推荐答案

我有同样的问题,比其他人建议的方法稍微干净一些(适用于我用simple_form)

I was having the same problem, and this might be a little cleaner than the workarounds others suggested (works for me with simple_form)

<%= f.input:remember_me,:as = ; :boolean,:label => false,:inline_label => true如果devise_mapping.rememberable? %>

这篇关于对齐“记住我”和复选框在同一行(CSS问题与Devise)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆