I am building a custom chips control and facing a problem in aligning a close div to the right and middle. Can someone help please. I want to align the close button vertically middle if the text wraps to multiple lines
<div class="chips-container">
<div *ngFor="let item of items; let i = index" class="chips">
<div class="chip-text">{{ item }}</div>
<div class="chip-close">x</div>
</div>
<input
class="input-chips"
(keyup.enter)="add($event)"
(keyup)="autogrow($event)"
style="width: 15px"
/>
</div>
My Style
.chips-container {
border: 1px solid gray;
height: auto;
min-height: 30px;
width: 230px;
position: relative;
}
.chips {
background-color: rgb(236, 236, 236);
border: 1px solid rgb(124, 124, 124);
border-radius: 14px;
margin: 3px;
padding-left: 3px;
height: auto;
display: inline-block;
}
.chip-text {
display: inline-block;
vertical-align: middle;
word-wrap: break-word;
}
.chip-close {
background-color: rgb(204, 204, 204);
height: 20px;
width: 20px;
border-radius: 50%;
//display: inline-block;
text-align: center;
margin-left: 2px;
float: right;
}
I replaced my Divs with table layout and it looks good, however, my input text control aligns in the bottom
<div class="chips-container">
<table
*ngFor="let item of pgFilters[i].value; let i = index"
class="chips"
>
<tr>
<td class="chip-text">{{ item }}</td>
<td><div class="chip-close">x</div></td>
</tr>
</table>
<input
style="width: 15px"
/>
</div>
