CSS-如何修剪文本输出? [英] CSS - how to trim text output?
本文介绍了CSS-如何修剪文本输出?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有任意数量的文本将在有限的空间中显示.
I have an arbitrary amount of text that will be displayed in a confined space.
如何修剪输出,以便不显示该框之外的所有内容,或者或如何强制该框创建垂直滚动条?
How can I trim the output so that whatever is "beyond" the box is not displayed, or how can I force the box to create a vertical scroll bar?
推荐答案
overflow
属性.您可以将值设置为 hidden
(隐藏)以隐藏数据,并设置为 scroll
(滚动)以滚动数据.
The overflow
property. You can set the value to hidden
to hide the data and scroll
to scroll the data.
<div class="text">this is some text that would be very long...</div>
//Hidden
.text
{
overflow: hidden;
width: 50px;
height: 50px
}
//Scroll
.text
{
overflow: scroll;
width: 50px;
height: 50px
}
这篇关于CSS-如何修剪文本输出?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文