Home > Article > Web Front-end > Introduction to the method of using css to center the page
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
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!