Home>
I'm making my own app with rails, but I want to stop the resizing function of the multi-line text input field used in the form input field of the new action.

As far as I looked at it with CSS

textarea {
  resize: none;
  }


I tried to do so, but it didn't work.
Please let me know if there is an appropriate method.

new.html.erb

<% @page_title = "Add new information"%>
<% = @page_title%>
<td><% = link_to "Back to details", @cow%></td>
<% = form_for @treat do | form |%>
  <% = render "form", form: form%>
  <% = form.submit%>
<% end%>

_form.html.erb

<table class = "form">
   <tr>
     <th><% = form.label: posted_at, "Date"%></th>
     <td><% = form.date_select: posted_at, start_year: 2010, end_year: Time.current.year,
             use_month_numbers: true%></td>
     <th>Item</th>
       <td>
         <% = form.select: content, ["treatment", "fertilization", "pregnancy", "dry milk", "parturition"]%>
       </td>
     </tr>
     <tr>
      <th>Content</th>
      <td colspan = "3"><% = form.text_area: detail, size: "70 * 20"%></td>
     </tr>
</table>

table.css

table {
  margin-right: auto;
  margin-left: auto;
}
table.list, table.attr {
  font-size: 100%;
  width: 70%;
}
 table.list td, table.attr td {
   background-color: #cee;
   border: 1px green solid;
   text-align: center;
 }
 table.detail {
   font-size: 200%;
   width;30%;
 }
 table.detail td {
   background-color: #cee;
   border: 1px green solid;
   text-align: center;
 }
 table.form {
  font-size: 100%;
  width: 50%;
}
table.form td, table.form th {
   background-color: #cee;
   border: 1px green solid;
   text-align: center;
 }

 table.index {
  font-size: 100%;
  width: 20%;

 table.index td {
   background-color: #cee;
   border: 1px green solid;
   text-align: center;
   }
 textarea {
   resize: none;
   }
  • Answer # 1

    I checked the log and found that it was using a file other than the CSS file that described the textarea, so when I moved the description of the textarea there, I was able to stop the resizing function in the input field. .