HTML设置td内容居中
HTML设置td内容居中
1、利用align属性
align 属性规定单元格中内容的水平对齐方式。当属性值为“center”,设置居中对齐内容。
<table border="1" width="200">
<tr>
<th>姓名</th>
<th>年龄</th>
</tr>
<tr>
<td align="center">Peter</td>
<td>20</td>
</tr>
<tr>
<td>Lois</td>
<td>20</td>
</tr>
</table>
2、利用style属性添加居中对齐样式
<table border="1" width="200">
<tr>
<th>姓名</th>
<th>年龄</th>
</tr>
<tr>
<td>Peter</td>
<td>20</td>
</tr>
<tr>
<td style="text-align: center;">Lois</td>
<td>20</td>
</tr>
</table>
本文出至:学新通
- 版权申明: 本站部分内容来自互联网,仅供学习及演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,请提供相关证据及您的身份证明,我们将在收到邮件后48小时内删除。
- 本站站名: 学新通
- 本文地址: https://www.swvq.com/boutique/detail/2026
- 联系方式: luke.wu@swvq.com
- 来源链接: www.php.cn/div-tutorial-486438.html
系列文章
更多
同类精品
更多
精彩评论
-
docker hub 进不去怎么办
PHP中文网 03-15 -
2023年最新的28道PHP面试题附答案
PHP中文网 03-27 -
windows上查看nginx是否启动
PHP中文网 04-19 -
推荐五款xml编辑工具
PHP中文网 03-04 -
navicat怎样清除注册表
PHP中文网 04-05 -
ChatGPT应用通过Axios+EventSource使用GPT3.5 API
uWydnA 03-13 -
强力推荐10款好看使用的Bootstrap后台管理系统模板
PHP中文网 03-09 -
vscode怎么调整代码大小两种方法
PHP中文网 03-11 -
navicat连接sqlserver数据库
PHP中文网 04-03 -
navicat导入csv文件
PHP中文网 03-30