简体   繁体   English

填充 min-height, max-height parent 的剩余高度

[英]Fill remaining height of min-height, max-height parent

I'm have a container which is of height:我有一个高度的容器:

.contact__user-input {
  max-height: 50vh;
  min-height: 50vh;
  overflow: scroll;
}

Inside of this container, as the last child, I have a textarea .在这个容器内,作为最后一个孩子,我有一个textarea This element is supposed to fill the remaining height - how can I do so?这个元素应该填充剩余的高度 - 我该怎么做?

<div class="contact__user-input">
   ...
   <textarea class="contact__textarea separator--small mt-4 w-100" placeholder="Sonstige Leistungen oder eine Nachricht an uns (optional)"></textarea>
</div>

Here you go:这里是 go:

As you keep adding the data it will keep appending it until it reaches height:50vh;当您继续添加数据时,它会继续添加数据,直到达到height:50vh; then a scroll will be seen.然后会看到一个卷轴。

View it in full screen for the height variations.全屏查看高度变化。

 .contact__user-input { overflow: scroll; min-height: 50vh; max-height: 50vh; display: flex; }
 <div class="contact__user-input">... <textarea class="contact__textarea separator--small mt-4 w-100" placeholder="Sonstige Leistungen oder eine Nachricht an uns (optional)"></textarea> </div>

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

相关问题 容器的最小高度和最大高度以及子对象的相对高度 - min-height and max-height of container and relative height of child 如何在slimScroll中设置最小高度和最大高度? - how to set the min-height and max-height in slimScroll? 最小高度和最大高度的范围及其缩放级别 - Range of min-height and max-height with their zoom level CSS容器Min-Height Max-Height声明 - CSS Container Min-Height Max-Height declarations 为什么当父元素具有最小高度/最大高度值但没有高度值时,子元素的 height: 100% 不适用? - Why does height: 100% on a child element not apply when the parent element has a min-height/max-height value but no height value? 如何设置画布元素的最小宽度、最大宽度、最小高度、最大高度 - how to set min-width, max-width, min-height, max-height for canvas element 将最小宽度,最小高度,最大宽度和最大高度与孩子可见性结合在一起 - Combine min-width, min-height, max-width and max-height with child visibility 如何将最小高度和最大高度设置为等于窗口高度 - How to set min-height and max-height equal to window Height Flex增长直到垂直居中的div内的特定最大高度,最小高度为100% - Flex Grow until specific max-height inside of a vertically centered div with min-height 100% 在CSS中设置max-height和min-height属性(或通过jQuery) - Setting max-height AND min-height property in CSS (or via jQuery)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM