Html 如何使表单输入字段变大?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2528047/
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
How to make a Form Input Field Large?
提问by John
For the form below, how could I make the input field big, like maybe 100 pixels in height by 400 pixels in length?
对于下面的表单,我怎样才能使输入字段变大,比如高 100 像素,长 400 像素?
Thanks in advance,
提前致谢,
John
约翰
<form action="http://www...com/sandbox/comments/comments2.php" method="post">
<input type="hidden" value="'.$_SESSION['loginid'].'" name="uid">
<div class="addacomment"><label for="title">Add a comment:</label></div>
<div class="submissionfield"><input name="title" type="title" id="title" maxlength="1000"></div>
<div class="submissionbutton"><input name="submit" type="submit" value="Submit"></div>
</form>
回答by Sparky
Any reason not to use a TEXTAREA form element instead?
有什么理由不使用 TEXTAREA 表单元素?
<textarea rows="5" cols="80" id="TITLE">
</textarea>
回答by pixeltocode
you can avoid using the div by applying the class in the <input>
itself
您可以通过在<input>
自身中应用类来避免使用 div
your CSS can be
你的 CSS 可以是
.submissionfield { width: 90px; height: 390px; border: 1px solid #999999; padding: 5px; }
回答by cmac
You can add css to the input, like:
您可以将 css 添加到输入中,例如:
.input-element{
font-size: 100px; // for say a select
width: 400px;
}
or you can add height but you might have to add !important to it...
或者您可以添加高度,但您可能必须添加 !important...
.input-element{
height: 100px !important;
width: 400px;
}
回答by Mosfeq Anik
for better n bigger input field textarea is effective.
为了更好的 n 更大的输入字段 textarea 是有效的。
<textarea type="text"
name="pre_book_sugg"
class="form-control"
style="height: calc(2.5em + 4.75rem + 2px);"
>
>
//input value
//输入值
回答by Nellie
You can also change the font-size in the css.
This will make the input boxes bigger, and allow for more readable text.
您还可以更改 css 中的字体大小。
这将使输入框更大,并允许更易读的文本。
Chrome
铬合金
CSS
CSS
form input{
font-size: 2em;
}