【发布时间】:2026-01-28 06:20:23
【问题描述】:
我有一个带有简单表单和引导程序的 rails 4 应用程序。
我的表单中有复选框元素。我想对齐复选框以与其他字段中的内容垂直对齐。目前,该复选框比其他字段中的其余内容更靠左。
例如:
<%= f.input :experiment, :as => :boolean, :label => false, inline_label: 'Do you want experiment logs or methods?' %>
有谁知道如何使垂直对齐方式统一,以使复选框不会出现在其余表单元素的左侧?
谢谢
为了扩展上述内容,
我希望复选框与其他表单元素的左边缘对齐。目前,它更靠左(就像该复选框元素上有某种负边距一样)。
我希望所有这三个字段输入在左对齐时齐平。目前,两个布尔元素中的复选框比第三个文本字段更靠左:
<%= f.input :survey, :as => :boolean, :label => false, inline_label: 'Do you need survey responses?' %>
<br><br>
<%= f.input :survey_link, label: 'Where is your survey?', :label_html => { :class => 'question-data' }, placeholder: 'Include a link to your survey', :input_html => {:style=> 'width: 650px; margin-top: 20px', class: 'response-project'} %>
<br>
<%= f.input :experiment, :as => :boolean, :label => false, inline_label: 'Do you want experiment logs or methods?' %>
【问题讨论】:
-
如果您向我们展示演示,那就太好了。目前还不清楚您要达到的目标。
-
嗨 - 我在上面添加了示例。两个复选框元素位于文本输入元素的左侧。我希望它们都齐平
标签: css ruby-on-rails twitter-bootstrap simple-form