简体   繁体   English

非常简单:具有最小高度行和 100% 高度的 textarea?

[英]Very simple : textarea with min height-rows and 100% height?

I have a div containing a textarea element.我有一个包含textarea元素的 div。
And I need to give it the right vertical size.我需要给它合适的垂直尺寸。

The container Div have right size.容器 Div 大小合适。 (100%) (100%)
I want to give a min-height or min rows, to provide a scroll if necessary, and a height of 100% (the 100 % of div).我想给出一个最小高度或最小行,必要时提供一个滚动,以及 100% 的高度(div 的 100%)。
I can't.我不能。 I don't know how to do this.我不知道该怎么做。 I need an example.我需要一个例子。

The very basic example is非常基本的例子是

<html>
<body>

<div style="height:100%;border:1px solid green;">
    <textarea style="min-height:100px;height:100%;width:100%;border:1px solid red;"></textarea>
</div>

</body>

Borders are only to show dimensions.边框仅用于显示尺寸。 But in your case it might be more complicated.但在你的情况下,它可能更复杂。 Please look at the definition of acontaining block and height calculation .请查看包含块的定义和高度计算

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM