在右侧显示省略号并将文本右对齐
Show ellipsis on right side and align text to right
我把 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:\fakepath6571_1398802860346752_2094565473_n.jpg</span>
</div>
有人可以帮我解决这个问题吗?
使用 text-align:right 代替 direction:rtl
<div class="file-upload-status" style="width:200px">
<span class="star">*</span>
<span> C:\fakepath6571_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;
}
Fiddle: https://jsfiddle.net/mnevrs02/
删除方向: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;
}
我把 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:\fakepath6571_1398802860346752_2094565473_n.jpg</span>
</div>
有人可以帮我解决这个问题吗?
使用 text-align:right 代替 direction:rtl
<div class="file-upload-status" style="width:200px">
<span class="star">*</span>
<span> C:\fakepath6571_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;
}
Fiddle: https://jsfiddle.net/mnevrs02/
删除方向: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;
}