【发布时间】:2018-08-07 23:20:45
【问题描述】:
我在我的 Angular-6 项目中使用 Bootstrap-4 模态。 对于modal,Modal-Header是固定高度,Modal-Body是可滚动的,Modal-Footer是可变高度但不能滚动的。
以下是我的基本 HTML:
/*for debugging purpose*/
.modal {
display: block !important;
}
.modal-footer {
display: flex;
align-items: center;
justify-content: flex-end;
border-color: #e0e0e7;
padding: 15px 20px 15px 55px;
min-height: 70px;
border-top: 1px solid #e9ecef;
}
.comment-input {
position: relative;
width: 100%;
min-height: 40px;
}
.textarea {
max-height: 80px;
overflow: auto;
width: 100%;
min-height: 40px;
padding: 10px 10px 10px 16px;
word-wrap: break-word;
line-height: 20px;
}
.textarea:empty:not(:focus)::before {
content: 'Type your comments here';
position: absolute;
}
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" rel="stylesheet" />
<div class="modal" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header"></div>
<div class="modal-body"></div>
<div class="modal-footer">
<div class="comment-input">
<div class="textarea" contenteditable="true"></div>
</div>
</div>
</div>
</div>
</div>
我试图在插入四行文本后使我的 textarea 可滚动。在插入四行文本之前,modal-footer 应该随着 textarea 的增长而增加其高度。我试图通过上面的 HTML 和 CSS 来做同样的事情,但不知何故 modal-footer 并没有因为 textarea 的高度而增加。每一个可能的解决方案将不胜感激。谢谢。
【问题讨论】:
标签: javascript html css bootstrap-4