zoukankan      html  css  js  c++  java
  • text-overflow 文字溢出时的设置

    text-overflow : clip | ellipsis

    clip:
    不显示省略标记(...),而是简单的裁切。
    ellipsis:
    当对象内文本溢出时显示省略标记(...)
    1. 设置或检索是否使用一个省略标记(...)标示对象内文本的溢出。对应的脚本特性为textOverflow。
    2. text-overflow属性仅是注解,当文本溢出时是否显示省略标记。并不具备其它的样式属性定义。要实现溢出时产生省略号的效果还须定义:强制文本在一行内显示(white-space:nowrap)及溢出内容为隐藏(overflow:hidden),只有这样才能实现溢出文本显示省略号的效果。
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>text-overflow</title>
    </head>
    <body>
    <style type="text/css">
    .test_demo_clip{text-overflow:clip; overflow:hidden; white-space:nowrap; 200px; background:#ccc;}
    .test_demo_ellipsis{text-overflow:ellipsis; overflow:hidden; white-space:nowrap; 200px; background:#ccc;}
    </style>
    <h2>text-overflow : clip </h2>
    <div class="test_demo_clip">
    不显示省略标记,而是简单的裁切条
    </div>
    <h2>text-overflow : ellipsis </h2>
    <div class="test_demo_ellipsis">
    当对象内文本溢出时显示省略标记
    </div>
    </body>
    </html>
  • 相关阅读:
    [bzoj3999] [TJOI2015]旅游
    [bzoj3143] [HNOI2013]游走
    [bzoj3140] [Hnoi2013]消毒
    [bzoj3142] [HNOI2013]数列
    [bzoj4860] [BeiJing2017]树的难题
    [bzoj2599] [IOI2011]Race
    [bzoj1558] [JSOI2009]等差数列
    [bzoj3626] [LNOI2014]LCA
    [bzoj4011] [HNOI2015]落忆枫音
    JQuery
  • 原文地址:https://www.cnblogs.com/huntaheart/p/3593442.html
Copyright © 2011-2022 走看看