Home » Html » How to remove extra space inside textarea

How to remove extra space inside textarea

Posted by: admin January 2, 2018 Leave a comment


I have a textarea which displays some data from “history” column in my database.
For unknown reason there is nearly 1.5 line of extra space before the text. Anyone can give me some idea why does it happen?
Here is my HTML piece:

      <th > History:</th>
        <textarea style="margin-left:90px";  name="history"cols="80"label="notes"rows="4"wrap="virtual"> 
        <?php echo $my_class->history;?></textarea>

You can see the problem here:enter image description here


Its because your php tag is on a newline. It is reading in the whitespace from where <textarea> ends until php tag opens. Put this all on one line to fix.


I know its late but may help others.

use this when document indentation is required.


Same Question : https://stackoverflow.com/a/44773825/3775083


Just put your php open tag right after the textarea close tag.. Dont use line break.. And close php exactly before (as you have done).. This will erase all the whitespaces..


Put this all on one line for fix this issue.Make your code like this.

<textarea style="margin-left:90px";name="history"cols="80"label="notes"rows="4"wrap="virtual"><?php echo $my_class->history;?></textarea>