我在simple_form中有一个日期字段,如下所示:
<%= f.input :dob, as: :date, start_year: Date.today.year - 12,
end_year: Date.today.year - 110, discard_day: true,
order: [:month, :year],
label: "Date of birth" %>
它工作正常,但每个选择(月份和年份)具有相同的宽度。
我想为年份部分指定不同的宽度,有关如何实现这一点的想法吗?
干杯
答案 0 :(得分:0)
您可以在样式表中更改此内容,因为Rails和simple_form会使用ID标记输入表单。
实施例。假设您有一个Person模型,并且您正试图抓住dob。
呈现片段形式部分(_form.html.erb)
<select class="date required" id="person_dob_3i" name="person[dob(3)]">
人样式表person.css.scss
#person_dob_3i {
width: 50px;
border: 1px solid #ccc;
}