美文网首页
CSS设置超过再两行显示省略号

CSS设置超过再两行显示省略号

作者: leslie1943 | 来源:发表于2020-04-16 23:17 被阅读0次
大部分场景都是超过一行就显示...
<template>
  <div class="other-product-item item-name" :title="item.name">{{item.name}}</div>
  <div class="other-product-item item-name" :title="item.name">{{item.name}}</div>
<template>
<script>
  export default {
    return {
      item: {name:'this is a very long name,this is a very long name,this is a very long name'}
    }
  }
</script>
<style lang="scss">
  .other-product-item {
    text-overflow: -o-ellipsis-lastline;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
  }
  .item-name {
    font-size: 14px;
  }
</style>
image.png

相关文章

网友评论

      本文标题:CSS设置超过再两行显示省略号

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