Home >Web Front-end >HTML Tutorial >Example code for horizontally and vertically centered display of the content of a table in HTML

Example code for horizontally and vertically centered display of the content of a table in HTML

高洛峰
高洛峰Original
2017-03-28 09:47:292787browse

This article mainly introduces the relevant information on the horizontal and vertical centering of the content of tabletable in html. Friends who need it can refer to the following

Specify in the CSS style file

#class td /*设置表格文字左右和上下居中对齐*/ 
{  
    vertical-align: middle;
    text-align: center;  
}
/*class 是所属的类*/
<p>                                                                      
</p>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

title

                                                              
序号适用情况详情备注
1xxxxx                                                                                                                                                      xxxxxx
                                                                                                                                                        
                                                                      
查看详情
 

The above is to specify the id as class in p, then the attribute of table td uses the style specified in css, as shown roughly in the figure

Example code for horizontally and vertically centered display of the content of a table in HTML

The above is the detailed content of Example code for horizontally and vertically centered display of the content of a table in HTML. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn