https://jsfiddle.net/g0Lf42bq/6/#&togetherjs=khq05DeHEp
我有一个包含文本+图标的div
(所需的行为就像在GMAIL收件箱中,当鼠标悬停在邮件上时,图标会显示出来,文本是省略号)
目前,文本不是省略号,我看不到所有的图标
.selected-field-name {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.field-section {
display: flex;
justify-content: space-between;
background: #FFFFFF;
border: 1px solid #CCCED3;
box-sizing: border-box;
border-radius: 2px;
font-weight: 400;
font-size: 12px;
line-height: 14px;
color: #37383A;
padding: 6px;
margin-top: 10px;
width: 195px;
max-width: 195px;
}
.remove-field {
display: none;
}
.field-section:hover .remove-field {
display: flex;
}
<div class="field-section">
<div class="selected-field items-center">
<div class="selected-field-name">{{selectedField.name}}</div>
</div>
<div class="d-flex">
<icon-button class="remove-field" Icon="plus" width="16px" height="16px" (click)="removeField(selectedField)"></icon-button>
<icon-button class="remove-field" Icon="x-close" width="16px" height="16px" (click)="removeField(selectedField)"></icon-button>
</div>
</div>