Html 如何在Bootstrap 3中将Textarea设置为100%高度?

Html 如何在Bootstrap 3中将Textarea设置为100%高度?,html,css,twitter-bootstrap-3,Html,Css,Twitter Bootstrap 3,我想将textarea设置为100%高度。我正在使用,但在那里找不到选项 <div class="container"> <textarea class="form-control" rows="8"></textarea> </div> 如何操作?您可以使用CSS: textarea { min-height: 100%; } textarea { height: 100%; } 相对于顶层 html, body, .c

我想将
textarea
设置为100%高度。我正在使用,但在那里找不到选项

<div class="container">
<textarea class="form-control" rows="8"></textarea>
</div>

如何操作?

您可以使用CSS:

textarea { 
   min-height: 100%;
}
textarea {
    height: 100%;
}
相对于顶层

html, body, .container {
  height: 100%;
}
textarea.form-control {
  height: 100%;
}

请参见

我认为这是一个引导问题。我遇到了一个类似的问题,textarea不允许超过1行。我发现(通过反复试验)将textarea放在一个div中,然后忽略第一个div中的formgroup-(x)调用,我能够控制textarea中的行和列

<div class="form-group">
    <label class="col-sm-3 control-label">Description</label>
    <div class="col-sm-9">
        <textarea class="form-control" rows="10"></textarea>
    </div>
</div>

描述
更改代码以使用表单组功能将更正此问题:

<div class="form-group">
    <textarea class="form-control" rows="8"></textarea>
</div>


这应该对你有好处。

这对我很有效。我也在使用bootstrap3。我的文本区在一个容器内

textarea {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

在bootstrap 3中对我不起作用-davidkonrad 您可以尝试修改行数

<textarea class="form-control" cols="60" rows="16"></textarea>

这就解决了我的问题。。我将高度设置为自动!重要的

<label for="item_description" style="padding-top: 10px;">Item Description</label>
<textarea class="form-control" name="item_description" rows="3" style="height:auto !important;"></textarea>
项目描述
.textarea{
位置:绝对位置;
身高:100%;
宽度:100%;
保证金:0;
填充:0;
}

文本区
订阅我的youtube频道

为什么不直接使用
高度:100%
?@Zhihao,因为它不是这样工作的,使用boostrap和所有预定义的默认设置。你试过了吗?它不起作用。这是一个引导问题。是的,但没有
block
。是我的错。看到JsFoDLE,我告诉过你,你需要先考虑主容器,比如<代码> DavIDKunrad < /Cord>你试过了吗?它不起作用。这是一个引导问题。
这正在工作。请编辑并添加一个工作代码段,以便用户可以测试代码
<label for="item_description" style="padding-top: 10px;">Item Description</label>
<textarea class="form-control" name="item_description" rows="3" style="height:auto !important;"></textarea>