• ellipsis


    语法: 
      text-overflow : clip | ellipsis 

    参数: 
      clip :  不显示省略标记(...),而是简单的裁切(clip这个参数是不常用的!)
          ellipsis :  当对象内文本溢出时显示省略标记(...)


    text-overflow
    我们可以用它代替我们通常所用的标题截取函数,而且这样做对搜索引擎更加友好,如:标题文件有50个汉字,而我们的列表可能只有300px的宽度。假如用标题截取函数,则标题不是完整的,假如我们用CSS样式text-overflow:ellipsis,输出的标题是完整的,只是受容器大小的局限不显示出来罢了。但是注意下面情况:
    一、仅定义text-overflow:ellipsis; 不能实现省略号效果

    二、定义text-overflow:ellipsis; white-space:nowrap; 同样不能实现省略号效果。

    三、同时应用: text-overflow:ellipsis; white-space:nowrap; overflow:hidden; 实现了所想要得到的溢出文本显示省略号效果。

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>无标题文档</title>
    <style type="text/css">
    ul { width:300px; margin:30px auto; } li { line-height:25px; text-overflow:ellipsis; white-space:nowrap; overflow:hidden; } a { color:#03c; font-size:14px; } a:hover { color:#333; } </style> </head> <body> <ul> <li>同时应用: text-overflow:ellipsis; white-space:nowrap; overflow:hidden; 实现了所想要得到的溢出文本显示省略号效果</li> <li>同时应用: text-overflow:ellipsis; white-space:nowrap; overflow:hidden; 实现了所想要得到的溢出文本显示省略号效果</li> <li>同时应用: text-overflow:ellipsis; white-space:nowrap; overflow:hidden; 实现了所想要得到的溢出文本显示省略号效果</li> <li>同时应用: text-overflow:ellipsis; white-space:nowrap; overflow:hidden; 实现了所想要得到的溢出文本显示省略号效果</li> <li>同时应用: text-overflow:ellipsis; white-space:nowrap; overflow:hidden; 实现了所想要得到的溢出文本显示省略号效果</li> </ul> </body> </html>


      
      

      

  • 相关阅读:
    ios 分享腾讯微博
    ios 分享微信
    elinput 价格校验 大于0保留2位小数,不包含01,01.1这种
    从范闲到许乐,从宁缺再到陈长生
    二进制流 ajax 实现图片上传
    php 操作redis 部分命令
    matlab 与vs2008联合编程的设置备忘
    新型机器人闯入职场:到底是工作缔造者还是工作终结者?
    c++ vs2008 多线程编程的样例
    虚拟试衣创业公司Fitiquette被印度电商Myntra收购
  • 原文地址:https://www.cnblogs.com/Xuman0927/p/5502500.html
Copyright © 2020-2023  润新知