要设置表格自动换行且不缩进,可以使用 CSS 样式来实现。可以在<style>标签中添加以下样式代码:

<style>
    table {
        word-wrap: break-word;
        table-layout: fixed;
    }
    td, th {
        white-space: normal;
    }
</style>

然后,在表格的<table>标签中添加以上样式,如下所示:

<table style='word-wrap: break-word; table-layout: fixed;'>
    <tr>
        <th style='white-space: normal;'>表头1</th>
        <th style='white-space: normal;'>表头2</th>
    </tr>
    <tr>
        <td style='white-space: normal;'>内容1</td>
        <td style='white-space: normal;'>内容2</td>
    </tr>
</table>

以上代码将设置表格自动换行,并且不会缩进文本。

HTML 表格自动换行且不缩进 - CSS 样式设置

原文地址: https://www.cveoy.top/t/topic/pk9m 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录