57

我有一个<textarea>HTML。当我将光标放在其中时,它不是从头开始,而是在中间闪烁。

HTML

<TD width="21%">
    <textarea class="txtarea" style="height:30px;" rows="3" name="Text" Id="Text" value=""> </textarea>
</TD>

CSS

.txtarea{
    border-right: #646464 ;
    border-top: #646464;
    border-left: #646464;
    border-bottom: #646464;
    width:100%;
    background: #ffffcc;
}
4

2 回答 2

188
<textarea class="txtarea" style="height:30px;" rows="3" name="Text" Id="Text" value=""> </textarea>

你所拥有的是<textarea></textarea>标签之间的空格。

于 2012-09-21T11:52:48.780 回答
0

Textarea 的开始和结束标记必须在同一行,因为无论在 textarea 标记之间,它都将被视为 textarea 的“值”。现在对于下面的代码占位符也将按预期显示。

<textarea
  placeholder="Enter text here" 
  class="txtarea"
  style="height:30px;"
  rows="3"
  name="Text"
  id="text"
></textarea>
于 2021-11-30T05:27:43.903 回答