【问题标题】:How to increase the text area in an input box in html/css?如何在 html/css 中增加输入框中的文本区域?
【发布时间】:2018-03-28 08:24:36
【问题描述】:

我有一个fiddle,我正在尝试使输入框更大。

我能够让它更大,但出于某些原因the writing cursor starts from the middle of a box whereas I want it to start from the extreme top-left of the input box,这样我就可以在其中写更多类似于this 的内容。

我用来使输入框变大的 CSS 是:

input 
{
    padding: 3px;
    width: 320px;
    height: 120px;
}

我不确定我需要在我的 HTML(在小提琴中)和 CSS 中进行哪些更改,以使书写光标从输入框中的最左侧开始。

【问题讨论】:

标签: html css


【解决方案1】:

您可以尝试使用padding-bottom 属性来获取文本

input 
{
  padding: 3px;
  width: 320px;
  height: 20px;
  padding-bottom: 100px;
}

但是您可能想要使用 textarea 而不是 input,就像您提到的示例中的那样,如果您想要多行文本。

<textarea name="text" cols="25" rows="5">
Add multiple lines of text here and watch the scrollbars grow...
</textarea>

【讨论】:

  • 成功了。我想知道我必须在asp中添加什么。我正在使用以下代码:
    &lt;asp:TextBox ID="txtLocationDesc" runat="server" CssClass="tb-std"&gt;&lt;/asp:TextBox&gt; &lt;/div&gt; 而不是 TextBox,我想我必须放一些其他东西,但我不确定我必须放什么。
  • @david — 我用谷歌搜索了“asp tag textarea”并在 SO 上找到了textarea control, asp.net c#,上面写着使用&lt;asp:TextBox id="TextArea1" TextMode="multiline" ... /&gt;
【解决方案2】:

为什么不直接创建一个textarea? 见小提琴here

【讨论】:

    【解决方案3】:

    我遇到了和你一样的问题,我们使用标签textarea而不是使用input标签解决了这个问题。

    我的问题解决了。

    【讨论】:

      猜你喜欢
      相关资源
      最近更新 更多
      热门标签