文本超长显示省略号,鼠标移上显示全部

https://blog.csdn.net/wxnjob/article/details/42009043

1.普通div中

<!DOCTYPE html>
<html>
<head>
<style> 
.icoFontlist:hover  
{  
    width: 425px;  
    font-size: 12px;  
    border: 0px solid #ddd;  
    overflow: hidden;  
    text-align: left;  
    text-overflow: ellipsis;  
    white-space: nowrap;  
    color:blue;  
    text-decoration:underline;  
    cursor:pointer;   
}  
.icoFontlist{  
    width: 225px;  
    font-size: 12px;  
    border: 0px solid #ddd;  
    color:#5f5f5f;  
    overflow: hidden;  
    text-align: left;  
    text-overflow: ellipsis;  
    white-space: nowrap;  
}  
</style>

</head>

<body>
<p>如果您把光标移动到下面两个 div 上,就能够看到全部文本。</p>

<div class="icoFontlist" title="这里是全部的信222息没有省略号,接下来演示如何处理超长文本显示省略号…" >这里是全部的信息没有省略号,接下来演示如何处理超长文本显示省略号</div>  

<div class="icoFontlist" >这里是全部的信息没有省略号,接下来演示如何处理超长文本显示省略号</div> 

</body>

</html>


2.在antd table中

less: 

.colClass {
  text-align: center;
  word-break: keep-all;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width:90%;
}
js:

const columns1 = [{
  title: '排名',
  dataIndex: 'rank',
  key: 'rank',
  align: 'center',
  width: '25%',
}, {
  title: '商家名',
  dataIndex: 'restName',
  key: 'restName',
  width: '25%',
  render:
    (text, record) => (
      <div title={record.restName} className={styles.colClass}>{record.restName}</div>
    ),
}, {
  title: '单量',
  dataIndex: 'orderSaleNum',
  key: 'orderSaleNum',
  align: 'center',
  width: '25%',
}, {
  title: '活动详情',
  dataIndex: 'actDetail',
  align: 'center',
  width: '25%',
  render:
    (text, record) => (
      <Popover
        content={this.getContent(record.restName)}
        trigger="click"
        placement="bottom"
      >
        <Button type="primary">查看活动</Button>
      </Popover>
  ),
}];


https://www.jb51.net/css/145465.html


https://www.cnblogs.com/zyl1994/p/7191400.html

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值