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;
    }
  • 相关阅读:
    动画 + 设置contentoffset,然后就 蛋疼了,
    xmpp这一段蛋疼的 坑,
    项目,
    一段测试代码,哦哦哦,
    libresolv,
    mutating method sent to immutable object'
    解析json,是还是不是,
    济南学习 Day 4 T1 am
    济南学习 Day 3 T3 pm
    济南学习 Day 3 T2 pm
  • 原文地址:https://www.cnblogs.com/linding/p/13278656.html
Copyright © 2011-2022 走看看