Html 文本框输入高度

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/13164048/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 03:39:20  来源:igfitidea点击:

text box input height

htmlcss

提问by user1785939

I made the size of the box bigger. it look bigger int the dream weaver design view but does not seem to work in the browsers.

我把盒子的尺寸变大了。它在 Dream Weaver 设计视图中看起来更大,但在浏览器中似乎不起作用。

<input type="text" **height="60%"**  name=" item" align="left" />

回答by Prasanth

If you want to increase the heightof the input field, you can specify line-heightcss property for the input field.

如果要增加输入字段的高度,可以line-height为输入字段指定css 属性。

input {
    line-height: 2em; // 2em is (2 * default line height)
}

回答by Sandeep Pattanaik

You can define a classor idfor input fields.

您可以为输入字段定义classid

Or

或者

input {
    line-height: 20px;
}

Hope this helps you.

希望这对你有帮助。

回答by Diodeus - James MacFarlane

Use CSS:

使用 CSS:

<input type="text" class="bigText"  name=" item" align="left" />

.bigText {
    height:30px;
}

Dreamweaver is a poor testing tool. It is not a browser.

Dreamweaver 是一个糟糕的测试工具。它不是浏览器。

回答by Dave

Just use CSS to increase it's height:

只需使用 CSS 来增加它的高度:

<input type="text" style="height:30px;" name="item" align="left" />

Or, often times, you want to increase it's height by using padding instead of specifying an exact height:

或者,通常情况下,您想通过使用填充而不是指定确切的高度来增加它的高度:

<input type="text" style="padding: 5px;" name="item" align="left" />

回答by Joey Cusimano

I came here looking for making an input that's actually multiple lines. Turns out I didn't want an input, I wanted a textarea. You can set height or line-height as other answers specify, but it'll still just be one line of a textbox. If you want actual multiple lines, use a textarea instead. The following is an example of a 3-row textarea with a width of 500px (should be a good part of the page, not necessary to set this and will have to change it based on your requirements).

我来这里是为了寻找一个实际上是多行的输入。原来我不想要输入,我想要一个文本区域。您可以按照其他答案指定的方式设置高度或行高,但它仍然只是文本框的一行。如果您想要实际的多行,请改用 textarea。下面是一个宽度为 500px 的 3 行 textarea 的示例(应该是页面的一个很好的部分,没有必要设置这个,必须根据您的要求进行更改)。

<textarea name="roleExplanation" style="width: 500px" rows="3">This role is for facility managers and holds the highest permissions in the application.</textarea>