zoukankan      html  css  js  c++  java
  • 用省略号替代文字超出部分

    css就能够处理这样的需求

    单行文本超出

    <!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>
            p{
                width: 200px;
                white-space: nowrap;
                overflow: hidden;
                text-overflow:ellipsis;
            }
        </style>
    </head>
    
    <body>
        <p>很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长</p>
    </body>
    </html>

     多行文本超出

    <!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>
            div {
                width: 200px;
                height: 40px;
                display: -webkit-box;
                -webkit-box-orient: vertical;
                -webkit-line-clamp: 2;
                overflow: hidden;
            }
        </style>
    </head>
    
    <body>
        <div>
            很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长 很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长 很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长
        </div>
    </body>
    </html>

    参考地址:地址

  • 相关阅读:
    NPOI导出excel表格应用
    通过用户密码获取共享文件
    sql之left join、right join、inner join的区别
    C#日志编写
    C#预编译指令
    匿名类型(C# 编程指南)
    反射
    SQL通用查询
    Lambda 表达式(C# 编程指南)
    自定义用户控件编写——(文件夹目录选择)
  • 原文地址:https://www.cnblogs.com/wuqiuxue/p/9065083.html
Copyright © 2011-2022 走看看