美文网首页
css文本溢出 html悬浮显示文本

css文本溢出 html悬浮显示文本

作者: 简小园 | 来源:发表于2023-01-27 14:51 被阅读0次

    文本溢出

    .textOverflow {
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
      word-break: break-all;
    }
    

    文本多行溢出

    .textOverflowMultiline {
        overflow: hidden;
        text-overflow: ellipsis;
        display: -webkit-box;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 3; // 显示行数
    }
    

    .textOverflowMulti(@line: 3, @bg: #fff) {
      position: relative;
      max-height: @line * 1.5em;
      margin-right: -1em;
      padding-right: 1em;
      overflow: hidden;
      line-height: 1.5em;
      text-align: justify;
      &::before {
        position: absolute;
        right: 14px;
        bottom: 0;
        padding: 0 1px;
        background: @bg;
        content: '...';
      }
    }
    

    悬浮显示文本信息

    给标签添加 title 属性,如下图:

    文本悬浮显示

    相关文章

      网友评论

          本文标题:css文本溢出 html悬浮显示文本

          本文链接:https://www.haomeiwen.com/subject/assehdtx.html