table布局 防止table变形 td固定宽度

防止table变形 td固定宽度

具体设置如下代码:

 1 <!doctype html>
 2 <html lang="en">
 3 
 4     <head>
 5         <meta charset="UTF-8" />
 6         <title>防止table变形 td固定宽度</title>
 7         <style type="text/css">
 8             table {
 9                 /*为表格设置合并边框模型*/
10                 border-collapse: collapse;
11                 /*列宽由表格宽度和列宽度设定*/
12                 table-layout: fixed;
13             }
14             
15             td {
16                 border: 1px solid #ddd;
17                 /*允许在单词内换行。*/
18                 word-break: break-word;
19                 /*设置宽度*/
20                 width: 100px;
21             }
22         </style>
23     </head>
24 
25     <body>
26         <table>
27             <tr>
28                 <td>DataDataDataDataDataDataDataDataDataDataDataData123</td>
29                 <td>Data</td>
30                 <td>Data</td>
31                 <td>Data</td>
32             </tr>
33             <tr>
34                 <td>Data</td>
35                 <td>Data</td>
36                 <td>Data</td>
37                 <td>Data</td>
38             </tr>
39         </table>
40     </body>
41 
42 </html>

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值