您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

html中table表格的内容水平和垂直居中显示实例代码

2026/1/30 21:51:21发布15次查看
这篇文章主要介绍了html中table表格的内容水平和垂直居中显示的相关资料,需要的朋友可以参考下
 在css样式文件中指定
#class td /*设置表格文字左右和上下居中对齐*/  {       vertical-align: middle;     text-align: center;   } /*class 是所属的类*/ <p id="class" align="center" style= "margin: 0cm 0cm 0pt; text-align: left">                                                                       <table class="table table-bordered" border="1" width="100%" style="font-size: 14pt; color: #000000; font-family: 楷体;mso-ascii-font-family: 'times new roman'; mso-hansi-font-family: 'times new roman'">                                                              <caption><h2 style="text-align: left;font-size: 16pt;font-family: 宋体;color: red;">title</h2>< /caption>                                                               <tbody >                                                                  <tr style="font-weight: bold;mso-bidi-font-size: 12.0pt;font-family: 宋体;" >                                                                       <td>序号</td>                                                                       <td>适用情况</td>                                                                        <td>详情</td>                                                                        <td>备注</td>                                                                     </tr>                                                                                                                                        <tr>                                                                     <td>1</td>                                                                      <td>xxxxx</td>                                                                       <td style="text-align: left;"> <!--指定靠左对齐-->                                                                       <span>                                                                              xxxxxx<br>                                                                                                                                                         </span>                                                                       </td>                                                                        <td><a href="#"></a> </td>                                                               </tr>                                                 </tbody>                                                           </table>  </p>
上述是在p指定id为class,则其中table的属性td使用的就是css中指定的样式,大致如图所示
以上就是html中table表格的内容水平和垂直居中显示实例代码的详细内容。
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product