How to center the table in html

藏色散人
Release: 2023-01-05 16:11:07
Original
54928 people have browsed it

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template