Каждый дает вам ответы, но не очень по причинам. Вот и все: если вы используете правило CSS visibility:hidden;
, текстовая область будет невидимой, но все равно будет занимать место. Если вы используете правило CSS display:none;
, текстовое поле будет скрыто и , оно не зарезервирует место на экране - без пробелов, другими словами, где бы оно не было. Визуальный пример ниже.
Итак, вы хотите, чтобы что-то вроде этого было полностью скрыто:
<textarea cols="20" rows="20" style="display:none;">
Пример
/* no styling should show up for either method */
textarea {
background: lightblue;
border: 1px solid blue;
font-weight: bold;
}
<p><strong>Textarea (not hidden)</strong></p>
<textarea>Text within.</textarea>
<p>Some text after.</p>
<hr />
<p><strong>Textarea with <code>display:none;</code></strong></p>
<textarea style="display:none;">Text within.</textarea>
<p>Some text after. Neither height nor margin/padding/layout kept. No other styles visible.</p>
<hr />
<p><strong>Textarea with <code>visibility:hidden;</code></strong></p>
<textarea style="visibility:hidden;">Text within.</textarea>
<p>Some text after. Height and margin/padding/layout kept. No other styles visible.</p>