twitter-bootstrap 如何在引导 css 框架中使输入文本更大?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/15706898/
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-10-21 16:46:43  来源:igfitidea点击:

How to make input text bigger in bootstrap css framework?

csstwitter-bootstraptextbox

提问by pynovice

I have a bootstrap textbox like this:

我有一个像这样的引导文本框:

 <input type="text" class="span9" required name="input_text"/>

I want my input box to be of height 300px. For the width, span9 handles it. I used Inspect element in Chrome and overwrite the css like this:

我希望我的输入框是 height 300px。对于宽度,span9 处理它。我在 Chrome 中使用了 Inspect 元素并像这样覆盖了 css:

input.span9, textarea.span9, .uneditable-input.span9 {
width: 852px;
height: 300px;

The text box looks good with the required height and width. But the problem is I can only type in the small portion in between the large text box. I want user to be able to type in the whole text box and even if textbox is not enough, I want to show the scrolling. How's that possible?

具有所需高度和宽度的文本框看起来不错。但问题是我只能输入大文本框之间的一小部分。我希望用户能够输入整个文本框,即使文本框不够用,我也想显示滚动。这怎么可能?

回答by woz

Per my comment, it's a quick fix. Use a <textarea>instead of <input>and it will function the way you described.

根据我的评论,这是一个快速修复。使用<textarea>代替,<input>它将按照您描述的方式运行。

回答by Rick Buczynski

Based on your question, it sounds like the issue has to do with CSS font-size and/or line-height properties.

根据您的问题,听起来问题与 CSS 字体大小和/或行高属性有关。

An input[text] element will inherit font-size and line-height properties from its parent or else the user agent settings.

input[text] 元素将从其父元素或用户代理设置继承 font-size 和 line-height 属性。

Try this:

试试这个:

input.span9, textarea.span9, .uneditable-input.span9 {
width: 852px;
height: 300px;
font-size:92px;
line-height:92px;
}

http://jsfiddle.net/xvznz/3/

http://jsfiddle.net/xvznz/3/

As far as "show the scrolling," that's not possible for a standard input[text]. But the above example shows scrolling as you would expect from a textarea element.

至于“显示滚动”,这对于标准输入[文本]是不可能的。但是上面的示例显示了您对 textarea 元素的期望的滚动。

So your solution is to tweak font-size and/or line-height CSS properties.

所以你的解决方案是调整 font-size 和/或 line-height CSS 属性。