use*_*059 18 html whitespace textarea
我有一个textarea,显示我的数据库中"历史"列的一些数据.由于未知原因,在文本之前有近1.5行的额外空间.任何人都可以告诉我为什么会这样?这是我的HTML文章:
<div>
<table>
<tr>
<th > History:</th>
<td>
<textarea style="margin-left:90px"; name="history"cols="80"label="notes"rows="4"wrap="virtual">
<?php echo $my_class->history;?></textarea>
</td>
</tr>
</table>
</div>
Run Code Online (Sandbox Code Playgroud)
你可以在这里看到问题:
Rev*_*ive 44
这是因为你的php标签在换行符上.它正在从空白处读取, <textarea>
直到php标签打开.把这一切都放在一行来修复.
把这一切放在一行来解决这个问题。让你的代码像这样。
<textarea style="margin-left:90px";name="history"cols="80"label="notes"rows="4"wrap="virtual"><?php echo $my_class->history;?></textarea>
Run Code Online (Sandbox Code Playgroud)
我知道它晚了,但可能会帮助其他人。
当需要文档缩进时使用它。
$('document').ready(function()
{
$('textarea').each(function(){
$(this).val($(this).val().trim());
}
);
});
Run Code Online (Sandbox Code Playgroud)