Home | 简体中文 | 繁体中文 | 杂文 | 打赏(Donations) | ITEYE 博客 | OSChina 博客 | Facebook | Linkedin | 知乎专栏 | Search | Email

11.9. 自适应宽度超出截取并显示省略字符

		
<style type="text/css">
.ellipsis {
    white-space: nowrap; 		/*保留文字间的空白*/
    width: 200px;
    overflow: hidden;  			/*超出部分隐藏,*/
    text-overflow: ellipsis; 	/*超出部分显示成... */
    border:1px solid #333;
}
</style>

<div class="ellipsis"> xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx </div>