我有一些用户可以填写的字段(例如姓名、电话号码、公司)。文本框大小适中,除了一个是“注释”字段。与其他文本框字段相比,我希望注释文本框非常大,但我只能使所有文本框大小相同。
_form.html.erb/vendors
<%= form_for @vendor do |f| %>
#this text field will be a regular size
<p>
<%= f.label :company %><br>
<%= f.text_field :company %>
</p>
#more code...
#I want this text field to be large
<body>
<div class = "notes">
<p>
<%= f.label :notes %><br>
<%= f.text_field :notes %>
</p>
</div>
</body>
<p>
<%= f.submit %>
</p>
</div>
<% end %>
我的CSS文件
input[type=text]{
width: 40%;
padding: 12px 12px;
border: 2px solid #ccc;
background-color: white;
}
textarea {
width: 20%;
height: 10px;
padding: 12px 12px;
border: 2px solid #ccc;
background-color: white;
resize: none
}
#more code...
最佳答案
您可以为该输入
添加一个具有您想要的样式(宽度)的类:
.large-box {
width: 60% !important;
}
然后,将其添加到您的输入
:
<%= f.text_field :notes, class: "large-box" %>
关于html - 制作不同大小的文本框,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44370859/