出现两列省略号。。。显示,文本溢出超出行数 默认2行

<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8"/>
<meta name="viewport" content="width=100%, initial-scale=1.0, user-scalable=no"/>
<meta content="telephone=no" name="format-detection" />
<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
<title>腾讯新闻</title>
<body>
     <ul class="ulRelNews">
         <li class="singlePicLi" url="">
             <div class="singlePic"><img src="http://inews.gtimg.com/newsapp_ls/0/57068827_150120/0" style="width: 100%; margin-top: 0px;"></div>
             <div class="singlePicRight">
                  <p class="titleHot"> 奥巴马与库里阿伦打高尔夫</p>
                  <span class="relSrc time_need_reform">8月16日</span>
                  <sapn class="relSrc">腾讯体育</sapn>
             </div>
         </li>
      </ul>
</body>
</html>

CSS代码为:

.ulRelNews ul{padding:10px;}
.ulRelNews li{ list-style: none; border-bottom: 1px solid #e4e5e7; padding: 10px 0; font-size: 0; overflow: hidden;}
.singlePic{ width: 75px; height: 60px; margin-right: 10px; float:left;}
.singlePicRight{ display: table-cell; vertical-align: middle; width: 100%; height: 60px;}
.titleHot{ margin: 0 0 4px; font-size: 16px; font-weight: 700; color: #47494c; line-height: 20px; overflow: hidden; word-break:break-all;-webkit-line-clamp:2;-webkit-box-orient:vertical; display: -webkit-box;}
.relSrc{ font-size: 13px; color: #8d8d8d; margin-right: 10px;}

第二种方式:超过两行出现。。。

.title{
    color:#333;
    font-size:0.45333rem;
    min-height:0.64rem;
    line-height:0.64rem;
    padding:0.34666rem 0 5px;
    word-break: break-all;
    .line-clamp(2)
  }
// 文本溢出超出行数 默认2行
.line-clamp(@line:2) {
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  /*! autoprefixer: off */
  -webkit-box-orient: vertical;
  /* autoprefixer: on */
  -webkit-line-clamp: @line;
}
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值