tag to center the table."/> tag to center the table.">
Home > Article > Web Front-end > How to center the table in html
How to center the table in html: First create a new html file; then enter the code "body {text-align: center;} table {margin: auto;}" in the
The operating environment of this article: Windows7 system, HTML5&&CSS3 version, Dell G3 computer.
How to set the table to be centered:
First, open the html editor and create a new html file, for example: index.html.
In the
The browser runs the index.html page, and the table is successfully centered using CSS.
Explanation:
css code body {text-align: center;} table {margin: auto;} are two element selectors, respectively Set css styles for the body and table elements.
In the W3C standard, element selectors are also called type selectors.
"The type selector matches the name of the document language element type. The type selector matches every instance of the element type in the document tree."
[Recommended learning: css video tutorial 】
The above is the detailed content of How to center the table in html. For more information, please follow other related articles on the PHP Chinese website!