How to restrict character limit by line or # of characters with css?

后端 未结 2 493
佛祖请我去吃肉
佛祖请我去吃肉 2021-02-05 16:15

Is there a css property that can do one of the following? But first, let me explain.

Imagine a masonry layout where each item is width: 200px; and each would be height:

2条回答
  •  挽巷
    挽巷 (楼主)
    2021-02-05 16:31

    You can try text-overflow, however it has some restrictions, but still might suite you:

    Example

    This is some short content to demonstrate the css-property text-overflow
    ​ #container{ width:100px; height:50px; border:1px solid red; overflow:hidden; text-overflow:ellipsis; white-space: nowrap; }​

提交回复
热议问题