我以相反的顺序显示direction:rtl;
,但我想在右侧而不是左侧截断多余的文本。
.file-upload-status {
border: 1px solid #ccc;
white-space: nowrap;
overflow: hidden;
direction: rtl;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
<div class="file-upload-status" style="width:200px">
<span>*</span>
<span></span> C:\fakepath\996571_1398802860346752_2094565473_n.jpg</span>
</div>
有人可以帮我吗?
答案 0 :(得分:1)
使用text-align:right代替direction:rtl
<div class="file-upload-status" style="width:200px">
<span class="star">*</span>
<span> C:\fakepath\996571_1398802860346752_2094565473_n.jpg</span>
</div>
.file-upload-status {
text-align:right;
border: 1px solid #ccc;
white-space: nowrap;
overflow: hidden;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.star{
float:right;
}
答案 1 :(得分:0)
移除方向:rtl并添加以下内容解决了我的问题
.file-upload-status {
border: 1px solid #ccc;
white-space: nowrap;
overflow: hidden;
display : flex;
flex-direction : row-reverse;
align-items: flex-start;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}