前端css如何设置一个3行文本溢出打点显示
时间: 2024-05-02 16:17:57 浏览: 95
可以使用CSS的text-overflow属性来设置文本溢出打点显示。
首先需要设置文本的宽度和高度,然后将overflow属性设置为hidden,最后使用text-overflow属性来设置打点显示。
以下是一个示例代码:
```html
<div class="text-container">
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam id quam libero.
</div>
```
```css
.text-container {
width: 200px;
height: 60px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
```
上面的代码将文本框的宽度设置为200px,高度设置为60px,超出部分将被隐藏。text-overflow属性设置为ellipsis,表示使用省略号来代替溢出的文本。white-space属性设置为nowrap,表示文本不换行。
这样就可以实现一个3行文本溢出打点显示的效果。
阅读全文
相关推荐
















