简体   繁体   English

在div框的流上方锚定标记文本

[英]anchor tag text over flow from div box

<div>
    <ul>
        <li><a href="#">Test_link_is_soooo_long</a></li>
    </ul>
</div>

<style>
div {
    border: 2px solid rgba(0,0,0,0.1);
    width: 150px;
}
a {
    overflow: hidden;
    text-overflow: ellipsis;
}
</style>

link text goes outside border and i want to fix it. 链接文本超出边界,我想修复它。 But not get any solution. 但没有任何解决方案。

result of above code 以上代码的结果

how I fix this problem. 我如何解决这个问题。

Use text ellipsis.if you dont want to increase the width of the div and display the link in a single line.The part going out of the with will be displayed as three dots 如果您不想增加div的宽度并将链接显示在一行中,请使用文本省略号.with之外的部分将显示为三个点

 div { border: 2px solid rgba(0,0,0,0.1); width: 150px; } a { width: 100px; display:inline-block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } 
 <div> <ul> <li><a href="#">Test_link_is_soooo_long</a></li> </ul> </div> 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM