Home  >  Article  >  Web Front-end  >  Introduction to the method of using css to center the page

Introduction to the method of using css to center the page

高洛峰
高洛峰Original
2017-03-15 09:40:031903browse

In the process of web page production, in order to facilitate readers' reading, the web page content will be limited to a smaller box and displayed in the center. How to implement this function?

1) Put the main text in a

tag. As long as this tag is centered, the entire web page will be centered.

2) Next, we will introduce a method: negative border, that is, the value of margin Is negative

#text{

padding-left: 50%;

width: 1000px;

margin-left: -500px

}

This way the page will be centered.


The above is the detailed content of Introduction to the method of using css to center the page. 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