前端外包优质服务商云客秀

我们凭借着对品牌的深刻理念,互联网营销趋势的敏锐洞察,帮助企业通过互联网建立优势。

当前位置:
首页>
荆州网站建设

前端切图外包,文本超出隐藏

  • 2024-03-05

直接上效果:相对于多行文本溢出做处理, 单行要简单多,且更容易理解。

overflow: hidden;
text-overflow:ellipsis;
white-space: nowrap;

实现多行文本溢出显示...

display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 3;
overflow: hidden;

这样 是不是你想要的呢?

div {
    position: relative;
    line-height: 20px;
    max-height: 40px;
    overflow: hidden;
}

div:after {
    content: "..."; position: absolute; bottom: 0; right: 0; padding-left: 40px;
    background: -webkit-linear-gradient(left, transparent, #fff 55%);
    background: -o-linear-gradient(right, transparent, #fff 55%);
    background: -moz-linear-gradient(right, transparent, #fff 55%);
    background: linear-gradient(to right, transparent, #fff 55%);
}

菜单