zoukankan      html  css  js  c++  java
  • flex 超出显示点点 ellipsis

    min-width

     .center {
            min- 200px;
            overflow: hidden;
            flex: 1;
            text-overflow: ellipsis;
            white-space: nowrap;
          }
    

    flex:1

    设置元素为flex:1;

    <!DOCTYPE html>
    <!--[if lt IE 7]>      <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
    <!--[if IE 7]>         <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
    <!--[if IE 8]>         <html class="no-js lt-ie9"> <![endif]-->
    <!--[if gt IE 8]>      <html class="no-js"> <!--<![endif]-->
    <html>
      <head>
        <meta charset="utf-8" />
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <title></title>
        <meta name="description" content="" />
        <meta name="viewport" content="width=device-width, initial-scale=1" />
        <link rel="stylesheet" href="" />
        <style>
          .flex {
            display: flex;
             100%;
          }
          .flex > div {
            height: 100px;
            line-height: 100px;
            flex: 1;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
          }
        </style>
      </head>
      <body>
        <div class="flex">
          <div>续犯驻雨绝针鲁渗召语添叫罪宅炉翠例济愧汇场论悄出入纸某览竟区</div>
          <div>续犯驻雨绝针鲁渗召语添叫罪宅炉翠例济愧汇场论悄出入纸某览竟区</div>
          <div>续犯驻雨绝针鲁渗召语添叫罪宅炉翠例济愧汇场论悄出入纸某览竟区</div>
        </div>
    
        <script src="" async defer></script>
      </body>
    </html>
    
    

    再嵌套一个元素

    .center {
            overflow: hidden;
            flex: 1;
          }
          .center > div {
            text-overflow: ellipsis;
            white-space: nowrap;
            overflow: hidden;
          }
    

    总结:多层的时候需要检查每一次的元素是否有宽度,没有就需要设置,否则就只有设置元素为的min-width才会显示点点。

  • 相关阅读:
    LeetCode--Divide Two Integers
    mysql多实例安装与ssl认证
    ajax请求
    mysql5.6升级及mysql无密码登录
    mysql5.7密码设置
    BusyBox 添加 自定义命令小程序 (applet)
    分享9个常用的国外英文论文文献数据库
    arm linux 移植 gdb/gdbserver
    使用 mtd-utils 烧写Arm Linux 系统各个部分
    YUV图解 (YUV444, YUV422, YUV420, YV12, NV12, NV21)
  • 原文地址:https://www.cnblogs.com/heihei-haha/p/14771846.html
Copyright © 2011-2022 走看看