在css:如果文本行是断点显示点 [英] On css: if text line is break show dots

查看:74
本文介绍了在css:如果文本行是断点显示点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在这个解决方案之前看到,但我不记得在哪里...没有JS

I seen before this solution but i not remember where exactly... without JS

也许它的工作,当线是break)
但什么css属性是?

maybe it's work when line is break) But what a css property is?

DEMO

<div>apple</div>
<div>jack fruit</div>
<div>super puper long title for fruit</div>
<div>watermelon</div>

div {
font-family: Arial;
background: #99DA5E;
margin: 5px 0;
padding: 1%;
width: 150px;
overflow: hidden;
height: 17px;
color: #252525;
}

问题是:
如果文本较长,比150px

Question is: how to show for user dots if text longer than 150px

推荐答案

你在谈论省略号吗?将它添加到您的CSS

Are you talking about an ellipsis? Add this to your CSS

text-overflow: ellipsis;
white-space: nowrap;

小提琴: http://jsfiddle.net/5UPRU/7/

这篇关于在css:如果文本行是断点显示点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆