HTML如何设置td内容居中(html,web开发)

时间:2024-05-02 19:17:12 作者 : 石家庄SEO 分类 : web开发
  • TAG :

设置方法:1、利用align属性,语法“<td align="center">...</td>”;2、利用style属性添加居中对齐样式,语法“<td style="text-align: center;">...</td>”。

本教程操作环境:windows7系统、HTML5版、Dell G3电脑。

HTML设置td内容居中

1、利用align属性

align 属性规定单元格中内容的水平对齐方式。当属性值为“center”,设置居中对齐内容。

<tableborder="1"width="200"> <tr> <th>姓名</th> <th>年龄</th> </tr> <tr> <tdalign="center">Peter</td> <td>20</td> </tr> <tr> <td>Lois</td> <td>20</td> </tr></table>

HTML如何设置td内容居中

2、利用style属性添加居中对齐样式

<tableborder="1"width="200"> <tr> <th>姓名</th> <th>年龄</th> </tr> <tr> <td>Peter</td> <td>20</td> </tr> <tr> <tdstyle="text-align:center;">Lois</td> <td>20</td> </tr></table>

HTML如何设置td内容居中

 </div> <div class="zixun-tj-product adv-bottom"></div> </div> </div> <div class="prve-next-news">
本文:HTML如何设置td内容居中的详细内容,希望对您有所帮助,信息来源于网络。
上一篇:html5如何实现进度条下一篇:

15 人围观 / 0 条评论 ↓快速评论↓

(必须)

(必须,保密)

阿狸1 阿狸2 阿狸3 阿狸4 阿狸5 阿狸6 阿狸7 阿狸8 阿狸9 阿狸10 阿狸11 阿狸12 阿狸13 阿狸14 阿狸15 阿狸16 阿狸17 阿狸18