CSS: Dynamic height via textarea

Viewed 1431

How do I make the container of modal adapt in size when textarea is dragged/resized? This is by the way a modal. Currently, when I resize the textarea, it overflows from the container.

Below are my CSS and HTML:

.dialog-box {
    position: absolute;
    width: 100%;
    height: 100%;
    top:0;
    left:0;
    z-index: 1000;
}
.dimmer {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    top:0;
    left:0;
    z-index: -1;
}
.container{
    background-color: #fff;
    width: 600px;
    height: 460px;
    position: absolute;
    border-radius: 5px;
    top:0;
    right:0;
    bottom:0;
    left:0;
    margin: auto;
    border: 1px solid #ebebeb;
    padding: 20px;
    align-items: center;
    z-index: 1;
}
<div  class="dialog-box" *ngIf="showDialogBox">
  <div class="dimmer" (click)="hide()"></div>
  <div class="container" >
    <h3>
        <ng-content></ng-content>
    </h3>
    <form class="ui form" [formGroup]="dialogForm" novalidate>
        <div class="field required">
            <label>Name</label>
            <input type="text" class="name" formControlName="name" placeholder="Enter Name..." maxlength="100" required/>
        </div>
        <div class="field">
            <label>Remarks</label>
            <textarea class="remark" formControlName="remark" placeholder="Enter Remarks..." maxlength="1000"></textarea>
        </div>
    </form>
    <ng-content select="[action]"></ng-content>
  </div>
</div>

2 Answers
Related