gpt4 book ai didi

html - rails : Use different-sized text areas within a single form

转载 作者:行者123 更新时间:2023-11-28 16:06:20 25 4
gpt4 key购买 nike

我有一个表单,其中不同的字段需要不同大小的文本区域。我想要这样的东西:

CSS 文件

textarea1 {
width: 170px;
height: 45px;

max-width: 100%;
max-height: 90px;
min-width: 170px;
min-height: 45px;
}

textarea2 {
width: 220px;
height: 70px;

max-width: 100%;
max-height: 110px;
min-width: 220px;
min-height: 70px;
}

然后在 HTML 中:

<%= f.label :smaller_entry, 'Smaller Entry' %>
<%= f.text_area1 :smaller %>

<%= f.label :bigger_entry, 'Bigger Entry' %>
<%= f.text_area2 :bigger %>

当然,“text_area”是我的“form”对象的关键字成员,所以我不能在末尾添加“1”和“2”。

最佳答案

你应该使用 css 类:

.textarea1 {
width: 170px;
height: 45px;

max-width: 100%;
max-height: 90px;
min-width: 170px;
min-height: 45px;
}
.textarea2 {
width: 220px;
height: 70px;

max-width: 100%;
max-height: 110px;
min-width: 220px;
min-height: 70px;
}

<%= f.label :smaller_entry, 'Smaller Entry' %>
<%= f.text_area :smaller, class: 'text_area1' %>

<%= f.label :bigger_entry, 'Bigger Entry' %>
<%= f.text_area :bigger, class: 'text_area2'%>

关于html - rails : Use different-sized text areas within a single form,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39149728/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com