转载 css截取td里面的内容 如何固定td th的宽度

源博客地址:http://blog.csdn.net/u011456552/article/details/53839255

效果图:

源码:

<!DOCTYPE html>  
<html lang="en">  
<head>  
    <meta charset="UTF-8">  
    <title>Szy1000</title>  
    <style>  
        body{  
            background-color: #ccc;  
        }  
        td{  
            padding: 0 10px;  
            width: 40px;  
            height: 30px;  
            overflow: hidden;  
            text-overflow: ellipsis;  
            white-space: nowrap;  
        }  
    </style>  
</head>  
<body>  
    <table style="border-collapse:collapse;table-layout:fixed;"  width="50%" border="1">  
        <tbody>  
            <tr>  
                <th width="80px">编号</th>  
                <th>内容</th>  
            </tr>  
            <tr>  
                <td width="80px">12123121231</td>  
                <td>12456</td>  
            </tr>  
        </tbody>  
    </table>  
</body>  
</html>  

 

posted on 2017-08-02 11:36  Geography爱好者  阅读(210)  评论(0编辑  收藏  举报

导航