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

藏色散人
藏色散人Original
2021-04-25 10:25:3454922browse

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

How to center the table in html

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.

How to center the table in html

In the

How to center the table in html

The browser runs the index.html page, and the table is successfully centered using CSS.

How to center the table in html

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!

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