In order for your markup to be edited, you need to follow some rules.
First of all, you are not using the <br> tag correctly. Read the description here and see the correct and incorrect use here.
Secondly, you use the rows="2" attribute to set the height of the textarea, but set its width in CSS using:
.form-control { width: 30%; }
Choose one design style for the test field so as not to be confused and your code remains supported.
Third, you are not using the position property correctly. In this example, the difference between relative and absolute is well described.
Fourthly, familiarize yourself with the box-sizing property , it will help to correct the situation with the fact that the button will have an indent from the edge of the test field.
Working example taking into account the recommendations:
.btn-default { background: #DC50FF; color: #ffffff; } .textarea-wrapper { position: relative; width: 30%; } .textarea-wrapper textarea.form-control { display: block; width: 100%; box-sizing: border-box; } .textarea-wrapper .textarea-clear { position: absolute; right: 0; top: 0; opacity: 0.6; }
<label class="btn btn-default btn-lg"> Browse <input #file type="file" hidden accept=".pptx"> </label> <p>Description of presentation :</p> <form> <div class="textarea-wrapper"> <textarea name="fileDescription" [(ngModel)]="desc" class="form-control"></textarea> <button class="textarea-clear" (click)="clear()">×</button> </div> </form> <button (click)="upload(file.files)" class="btn btn-primary"> Upload</button>