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>
ellipsis的更多相关文章
- python中的Ellipsis
...在python中居然是个常量 print(...) # Ellipsis 看别人怎么装逼 https://www.keakon.net/2014/12/05/Python%E8%A3%85%E9 ...
- 多行文本溢出显示省略号(…) text-overflow: ellipsis
详解text-overflow 语法: text-overflow:clip | ellipsis 默认值:clip 适用于:块级容器元素 继承性:无 动画性:否 计算值:指定值 取值: clip:当 ...
- css text-overflow:ellipsis 文字多余剪切
text-overflow: ellipsis;多度剪切white-space: nowrap;禁止换行overflow: hidden;多余隐藏
- 关于ellipsis多行换行的方案
WebKit浏览器或移动端的页面在WebKit浏览器或移动端(绝大部分是WebKit内核的浏览器)的页面实现比较简单,可以直接使用WebKit的CSS扩展属性(WebKit是私有属性)-webkit- ...
- CSS中的text-overflow:clip|ellipsis的使用
如果想让某个容器(div或者li或者...块级元素)显示一行文字,当文字内容过多时,不换行,而是出现...,可以使用text-overflow:clip|ellipsis 基本语法:text-over ...
- text-overflow:ellipsis
关键字: text-overflow:ellipsis 语法:text-overflow : clip | ellipsis 取值: clip :默认值 .不显示省略标记(...),而是简单的裁切. ...
- CCS3属性之text-overflow:ellipsis;的用法和注意之处
语法: text-overflow:clip | ellipsis 默认值:clip 适用于:所有元素 clip: 当对象内文本溢出时不显示省略标记(...),而是将溢出的部分裁切掉. ellipsi ...
- text-overflow:ellipsis实现超出隐藏时省略号显示
text-overflow:ellipsis;要达到的效果是:文字超出容器宽度时,文字被隐藏的文字用省略号代替.所以该属性只能用于块状元素或行内块元素中,对行内元素是不起作用的. 一般和white-s ...
- CSS基础:text-overflow:ellipsis溢出文本
<!DOCTYPE html><html> <head> <title> new document </title> <meta na ...
随机推荐
- util包下的Date与sql包下的Date之间的转换
Java中的时间类型 java.sql包下给出三个与数据库相关的日期时间类型,分别是: Date:表示日期,只有年月日,没有时分秒.会丢失时间: Time:表示时间,只有时分秒,没有年月日.会丢失日期 ...
- kylin cube测试时,报错:org.apache.hadoop.security.AccessControlException: Permission denied: user=root, access=WRITE, inode="/user":hdfs:supergroup:drwxr-xr-x
异常: org.apache.hadoop.security.AccessControlException: Permission denied: user=root, access=WRITE, i ...
- 一个java覆盖的例子
// 覆盖class P{}class Q extends P{} class a{ static void m1(float x){ //静态方法不能被覆盖 System.out.println(& ...
- Angular JS学习之表达式
1.Angular JS使用表达式把数据绑定到HTML: 2.Angular JS表达式写在双大括号中:{{expression}} **Angular JS表达式把数据绑定到HTML,这与ng-bi ...
- 一个java集合使用bug
在使用java集合的时候有的时候集合是来自于一些第三方工具提供的从字符串或json 转出集合的对象有时是抽象类,这时的对象部分功能是未实现的,在使用相应操作的时侯 会引发bug. Exception ...
- 《用delphi开发共享软件》-15.2桌面提示器
打开一个配置文件: 打开一个配置文件 操作TStringGrid Procedure EmptyGrid(Var sg:TStringGrid); Var i:Integer; begin do sg ...
- 并查集(路径更新) LA 3027 Corporative Network
题目传送门 题意:训练指南P192 分析:主要就是一个在路径压缩的过程中,更新点i到根的距离 #include <bits/stdc++.h> using namespace std; c ...
- iOS App Transport Security has blocked a cleartext HTTP (http://) resource load since it is insecure.
You can easily add it to the plist using the GUI: On the last line add the + Enter the name of the g ...
- JavaScript eval() 函数
定义和用法:eval() 函数可计算某个字符串,并执行其中的的 JavaScript 代码. 语法:eval(string) 参数 描述 string 必需.要计算的字符串,其中含有要计算的 Java ...
- PHP初学[DAY2]
昨天安装了PHP的开发环境,根据一个百度经验里的介绍做的,可惜链接找不着了.目前状况是这样:在Apache24下有一个www的文件夹,通过编辑里边的index.php来学习PHP程序的编写,程序运行的 ...