Needs use right “text-overflow” when “direction” is set to “rtl”

给你一囗甜甜゛ 提交于 2019-12-01 01:16:47

Maybe something like this: http://jsfiddle.net/CBUH4/8/

    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;

This is the closest solution I could have got using just css. Still it has a drawback that we need to use multiple .'s which are approximately equal to the width of the span element.

Fiddle

HTML

<span class="file-upload-status ellipsis" style="max-width:200px">
    C:\fakepath\996571_1398802860346752_2094565473_n.jpg
</span>

<br/>
<span class="file-upload-status" style="max-width:200px">
    C:\fakepath\1.jpg
</span>

CSS

.file-upload-status {
    font-weight: bold;
    font-size: 16px;
    color: #888;
    background: #fff;
    border-radius: 7px;
    height: 27px;
    border: 1px solid #ccc;
    padding-left: 5px;
    padding-right: 5px;
    white-space: nowrap;
    overflow: hidden;
    direction: rtl;
    display:inline-block;
    width: 200px;
    position: relative;
}
.file-upload-status:after {
    content:".................................";
    color: white;
    position: relative;
    background-color: white;
    z-index: 2;
}
.file-upload-status:before {
    content:"...";
    position:absolute;
    background-color: white;
    left: 0px;
    top: 0px;
    z-index: 1;
}

Suggestion: Give as much dots as possible :D

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!