zoukankan      html  css  js  c++  java
  • 表格td内容过多时,td显示省略号,鼠标移入显示全部内容

    两种方式显示:

    1.title方式显示:

    <!DOCTYPE html>  
    <html>  
    <head>  
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title></title>  
    <style type="text/css">  
    .tb{800px;font-size:12px;background:#6887D9}  
    .tb thead th{height:25px;background:#217AC4;color:white}  
    .tb tbody td{height:22px;background:white;padding-left:3px;}  
    .autocut {  
        200px;  
        overflow:hidden;  
        white-space:nowrap;  
        text-overflow:ellipsis;  
        -o-text-overflow:ellipsis;  
        -icab-text-overflow: ellipsis;  
        -khtml-text-overflow: ellipsis;  
        -moz-text-overflow: ellipsis;  
        -webkit-text-overflow: ellipsis;  
    }  
      
    </style>  
    </head>  
    <body>  
     <table class="tb" border="0" cellpadding="1" cellspacing="1">  
        <thead>  
            <tr>  
                <th>Column1</th>  
                <th>Column2</th>  
                <th>Column3</th>  
            </tr>  
        </thead>  
        <tbody>  
            <tr>  
                <td>Column1</td>  
                <td width="200px;"><div class="autocut" title="放松的方式方法对所发生的放松的方式的方式">放松的方式方法对所发生的放松的方式的方式</div></td>  
                <td>Column3</td>  
            </tr>  
            <tr>  
                <td>Column1</td>  
                <td width="200px;"><div class="autocut" title="放松的方式方法对所发生的放松的方式的方式">放松的方式方法对所发生的放松的方式的方式</div></td>  
                <td>Column3</td>  
            </tr>  
            <tr>  
                <td>Column1</td>  
                <td width="200px;"><div class="autocut" title="放松的方式方法对所发生的放松的方式的方式">放松的方式方法对所发生的放松的方式的方式</div></td>  
                <td>Column3</td>  
            </tr>  
        </tbody>  
      </table>  
    </body>  
    </html>  
     
     
     
     

    2.切换class属性方式:

    <!DOCTYPE html>  
    <html>  
    <head>  
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title></title> 
    <style type="text/css">
    .li1 {
    list-style:none;
    100px;
    white-space:nowrap;
    text-overflow:ellipsis; 
    -o-text-overflow:ellipsis; 
    overflow: hidden;
    margin-top:5px; 
    }
     
    .li2{
    list-style:none;
    margin-top:5px;
    }
    </style>
    <script type="text/javascript"  src="jquery-1.11.3.js"></script> 
    </head>  
    <body> 
    <ul>
    <li class="li1" onmouseover="this.className='li2'" onmouseout="this.className='li1'"><a href="#">web标准常见问题大全web标准常见问题大全</a></li>
    <li class="li1" onmouseover="this.className='li2'" onmouseout="this.className='li1'"><a href="#">尽快了解了解可怜快捷链接里看见快乐建立</a></li>
    <li class="li1" onmouseover="this.className='li2'" onmouseout="this.className='li1'"><a href="#">和国际环境来看看窘境看见了开发机构了解了空间</a></li>
    <li class="li1" onmouseover="this.className='li2'" onmouseout="this.className='li1'"><a href="#">发电股份的合格两款发动机和旅客看了解了空间</a></li>
    <li class="li1" onmouseover="this.className='li2'" onmouseout="this.className='li1'"><a href="#">发电股份的高科技了发动机来看发给大家了发动机来看</a></li>
    </ul>
    </body>
    </html>

  • 相关阅读:
    关于asp.net页面自定义404错误码返回302的最新解决方法
    基于sharpdevelop核心和ArcEngine打造插件式桌面GIS应用(概述)
    WPF自定义控件踩坑记录,用户自定义控件 绑定后台定义的 命令 依赖项属性 注意事项 静态
    WPF C# 以非独占式读取本地图片
    C#DataGridView控件60招(一)
    用TEXT文件做数据源
    boost智能指针
    linux下安装boost库
    ASP/ASP.NET程序设计电子书专题下载
    Highcharts 点击多选框取消,添加数据上绑定最大,最小值和图例上绑定提示框数据
  • 原文地址:https://www.cnblogs.com/zch-lxh1314/p/8418412.html
Copyright © 2011-2022 走看看