博客列表 >文章单行超过容器省略号显示css实现

文章单行超过容器省略号显示css实现

magician风
magician风原创
2020年04月20日 10:41:05593浏览
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title>wjf</title>
  6. <style>
  7. div.test
  8. {
  9. white-space:nowrap;
  10. width:12em;
  11. overflow:hidden;
  12. border:1px solid #000000;
  13. }
  14. </style>
  15. </head>
  16. <body>
  17. <p>以下 div 容器内的文本无法完全显示,可以看到它被裁剪了。</p>
  18. <p>div 使用 &quot;text-overflow:ellipsis&quot;:</p>
  19. <div class="test" style="text-overflow:ellipsis;">This is some long text that will not fit in the box</div>
  20. </body>
  21. </html>
声明:本文内容转载自脚本之家,由网友自发贡献,版权归原作者所有,如您发现涉嫌抄袭侵权,请联系admin@php.cn 核实处理。
全部评论
文明上网理性发言,请遵守新闻评论服务协议