zoukankan      html  css  js  c++  java
  • css文本超出省略

    一、单行

    <div class="div">这是一段中文这是一段中文这是一段中文这是一段中文这是一段中文这是一段中文</div>
    .div {
      background-color: green;
       100px;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }

    二、多行

      1、私有属性

    <div class="div">这是一段中文这是一段中文这是一段中文这是一段中文这是一段中文这是一段中文</div>
    .div {
      background-color: green;
       100px;
      overflow: hidden;
      display: -webkit-box;
      -webkit-box-orient: vertical;
      -webkit-line-clamp: 3;
    }

      2、:before和:after

    <div class="div">这是一段中文这是一段中文这是一段中文这是一段中文这是一段中文这是一段中文</div>
    .div {
      background-color: green;
       100px;
      height: 63px;
      position: relative;
      overflow: hidden;
      text-align: justify;
    }
    
    .div:before {
      content: "...";
      background-color: green;
       18px;
      height: 21px;
      position: absolute;
      right: 0;
      bottom: 0;
    }
    
    .div:after {
      content: "";
      background-color: green;
       18px;
      height: 63px;
      position: absolute;
      right: 0;
    }
  • 相关阅读:
    eclipse修改web项目部署路径
    Jquery面试题
    23中设计模式之单例模式
    详细探讨单例模式
    java常用设计模式
    vue官网总结
    pytorch模型训练加速tricks
    element table显示滚动条
    vue中less文件全局引用
    vue路径别名无法识别,Cannot find module
  • 原文地址:https://www.cnblogs.com/linding/p/13278656.html
Copyright © 2011-2022 走看看