Search code examples
cssflexboxdirection

Show ellipsis on right side and align text to right


I put direction:rtl; to show in reverse order, but I want to truncate extra text at right side, but not left side.

   .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>

Can someone help me on this?


Solution

  • removing direction: rtl and adding below solves my problem

    .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;
    

    }