css 文本溢出显示省略号
<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>HTML5标签</title>
<style>
  p{
  	  /**
		white-space:nowrap;表示文本不会换行,在同一行继续,知道遇到<br>标签为止;
		overflow:hidden;不显示超过对象尺寸的内容,就是把超出的部分隐藏了;
		text-overflow:ellipsis;当文本对象溢出是显示...,当然也可是设置属性为clip不显示点点点;
		-o-text-overflow:为了兼容opera浏览器;
  	  */
		width:200px;
		overflow:hidden;
		text-overflow:ellipsis;
		-o-text-overflow:ellipsis;
		white-space:nowrap;
  }
  div{
  	/*文字超出高度不显示*/
  	overflow:hidden;
  	display:block;
  	height:60px;
  	width:100px;
  }
</style>
</head>
<body>
	<p>这样处理对搜索引擎更友好,因为标题实际上并未被截字,而是局限于宽度而未被显示而已。</p>
	<div>这样处理对搜索引擎更友好,因为标题实际上并未被截字,而是局限于宽度而未被显示而已。</div>
</body>
</html>
    每天用心记录一点点。内容也许不重要,但习惯很重要!
 
                    
                     
                    
                 
                    
                
 
                
            
         
         浙公网安备 33010602011771号
浙公网安备 33010602011771号