wangxuehao
<!DOCTYPE html>
<html>
<head>
<style> 
div.test
{
white-space:nowrap;                    //不换行
width:12em;  
overflow:hidden;                      //超出后隐藏 
border:1px solid #000000;
}
</style>
</head>
<body>

<p>下面两个 div 包含无法在框中容纳的长文本。正如您所见,文本被修剪了。</p>

<p>这个 div 使用 "text-overflow:ellipsis" :</p>

<div class="test" style="text-overflow:ellipsis;">This is some long text that will not fit in the box</div>   //超出部分省略号

<p>这个 div 使用 "text-overflow:clip":</p>

<div class="test" style="text-overflow:clip;">This is some long text that will not fit in the box</div>

</body>
</html>

  

分类:

技术点:

相关文章:

  • 2021-12-12
  • 2021-12-12
  • 2021-12-12
  • 2022-01-28
  • 2022-01-02
  • 2021-12-23
  • 2021-12-23
猜你喜欢
  • 2021-08-11
  • 2021-08-07
  • 2021-07-09
  • 2021-11-27
  • 2022-01-02
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案