适合文本在div [英] fit text inside div

查看:112
本文介绍了适合文本在div的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何适应大量的文字固定大小的div。我想要达到文本的最大宽度这个div,然后打破文本与dotts ...

how can i fit a large amount text a fixed size div.? i want when reach text maximum width of this div then break text with dotts...

我试过这个,我看不到结果真的我想要

i tried this, i dont see the result really what i want

.description {
  max-width:590px;
  max-height:100px;
  float:left;
}

我想要这张图片

推荐答案

给它一个固定宽度并使用 text-overflow CSS属性宽度a值省略号

Give it a fixed width and use text-overflow CSS property width a value ellipsis

演示

text-overflow: ellipsis;

注意:此操作只对单行生效

Note: This will be effective only for a single line

如果你想这应该工作在多行,那么你需要使用jQuery

If you want this should work on a multiple line, then you need to use jQuery

演示 Source

这篇关于适合文本在div的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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