首页 首页 >  文章资讯

table td自适应宽度设置(根据内容自动拉伸)

发布时间:2023-08-20 18:49:55 浏览次数:92次

table td或th如何格局单元格内容自适应宽度?table td th根据表格内容自动拉伸CSS属性,3117站长服务平台分享内联样式style和CSS方法:文章源自新手站长网-https://xinshouzhanzhang.com/tabletdnowrap.html

table td th自适应宽度样式

内联样式style方法:文章源自新手站长网-https://xinshouzhanzhang.com/tabletdnowrap.html

  1. <table>
  2. <tr>
  3. <th style="white-space:nowrap;">根据文字长度自动调整宽度</th>
  4. </tr>
  5. <tr>
  6. <td style="white-space:nowrap;">根据文字长度自动调整宽度</td>
  7. </tr>
  8. </table>

CSS方法:文章源自新手站长网-https://xinshouzhanzhang.com/tabletdnowrap.html

  1. td
  2. {
  3. white-space: nowrap;
  4. }

让table th tr根据单元格内容自动调整宽带的CSS样式为:white-space:nowrap;


【版权与免责声明】如发现内容存在版权问题,烦请提供相关信息发邮件至 lnkj@3173.top ,我们将及时沟通与处理。 本站内容除了3117站长服务平台( www.3117.cn )原创外,其它均为网友转载内容,涉及言论、版权与本站无关。