向引导元素添加填充

时间:2018-11-30 21:04:12

标签: ruby-on-rails-3 twitter-bootstrap-3 slim-lang

Rails 3.2
Bootstrap 3

在我看来(app / views / users / password_expired / show.html.slim),我有:

- content_for :page_header do
     = t('users.passwords.create_password')
   = form_for(resource, as: resource_name, url: [resource_name, :password_expired], html: {method: :post, class: "form-horizontal new_user"}) do |f|
     .form-horizontal-column.wide
       .form-group
         = devise_error_messages!
       .form-group style="width: 600px"
         = f.label :current_password, t('users.passwords.current_password')
         = f.password_field :current_password
       .form-group style="width: 600px"
         = f.label :password, t('users.passwords.new_pass')
         = f.password_field :password
       .form-group style="width: 600px"
         = f.label :password_confirmation, t('users.passwords.confirm_new_password')
         = f.password_field :password_confirmation
       div= f.submit t('users.passwords.change_my_password'), :class => "btn btn-primary btn-lg"
     .form-horizontal-column.shared-links

我期望在标签/输入字段和表单的左侧之间看到一些填充,但是我没有任何填充。看来所有其他形式都可以正常工作。

我如何在表单组的左侧添加一些填充而不更改引导样式,因为引导样式可以在其他地方使用?

1 个答案:

答案 0 :(得分:0)

与表单组一起,您可以添加some-css-class

.form-group.some-css-class

如果需要,在标签中添加some-css-class

f.label :password, t('users.passwords.new_pass'), class: "some-css-class"

然后定义其样式

.some-css-class {
/* define your margin/padding style */
}

并检查其是否符合您的规格...