当前位置: 动力学知识库 > 问答 > 编程问答 >

javascript - using ellipsis with label that is not starting from the div's begining

问题描述:

I have a label that is located inside a dynamically sized div.

the label starts from about the middle of the div

I am trying to add ellipsis to it but I just cant get it to start the ellipsis in the correct place

here is my code:

 <div id="container" style="text-overflow: ellipsis;overflow:hidden;width:50px">

<label id="myLabel" style="left: 20px!important;position: absolute;">test1234567890</label></div>

what am I doing wrong?

Thanks

网友答案:

Ellipsis property won't affect absolutely positioned element's, if you want to move label left AND keep ellipsis, you should set padding-left:20px; to div

分享给朋友:
您可能感兴趣的文章:
随机阅读: