首页 » 收集 » 正文内容
css文字溢出隐藏,一行文字或多行文字
寻梦xunm| 650| 收集
2年前
超过916天 温馨提示
本文最后更新于2022年03月19日,已超过916天没有更新,若内容或图片失效,请留言反馈。
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
        /* 文字显示一行,一行之后溢出隐藏 */
        .box {
            border: 1px solid black;
            max-width: 400px;
            overflow:hidden;
            text-overflow:ellipsis;
            white-space: nowrap;
            margin-bottom: 20px;
        }
        /* 多行文字 */
        .box1 {
            border: 1px solid black;
            max-width: 400px;
            display: -webkit-box;
            /* autoprefixer: off */
            -webkit-box-orient: vertical;
            /* autoprefixer: on */
            -webkit-line-clamp: 2;
            overflow: hidden;
        }
    </style>
</head>
<body>
    <div class="box">
        简书,创作你的创作,简书,创作你的创作,简书,创作你的创作,
        简书,创作你的创作,简书,创作你的创作,简书,创作你的创作,
        简书,创作你的创作,简书,创作你的创作,简书,创作你的创作,
    </div>
    <div class="box1">
        简书,创作你的创作,简书,创作你的创作,简书,创作你的创作,
        简书,创作你的创作,简书,创作你的创作,简书,创作你的创作,
        简书,创作你的创作,简书,创作你的创作,简书,创作你的创作,
    </div>
</body>
</html>

原文链接:https://blog.csdn.net/qq940853667/article/details/86537528

0 赞 or 打赏
喜欢就打赏一点
微信 支付宝
隐私
Q Q:1340326824
邮箱:vipshiyi@qq.com
QQ群:422720328

我的音乐

微博客-专为自己编写开发的源码