使用Div高度限制div内的文本 [英] Limit text inside div, using Div height

查看:186
本文介绍了使用Div高度限制div内的文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在网站上.它将要做的一件事就是允许管理员发布新闻.我所有的新闻div的高度和宽度都是固定的.
PHP向数据库查询文本,并将其切成500个字符的长度,因此文本不会退出我的div.
当然,这不是最好的方法,因为如果我全部使用大写字母,则500个大写字母比500个普通大写字母占用更多的空间....
如果我还使用/br/标记来更改行,那也是问题,因为php->(我认为)不会将其视为空格...

I'm currently working on a website. One of the things it will do is allow the admin to post news. all my news divs are fixed in height and width.
PHP queries the database for the text and cuts it at 500 characters lenght, so the text doesn´t exit my div.
Of course this is not the best approach since if I use all caps, 500 caps characters take more space than 500 normal ones....
If I also use the /br/ tag to change lines, that is also a problem, since php ->(i think) won't count that as empty spaces...

正如标题所示...我想知道是否有任何方法可以通过使用div的高度来限制div中文本的数量....

As the title suggests... I would like to know if there is any way of limiting the ammount of text in my div by using it's height....

提前谢谢!

推荐答案

看看 http: //www.w3schools.com/css/pr_pos_overflow.asp .

这篇关于使用Div高度限制div内的文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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