Home>Article>Web Front-end> How to center div in html
htmlHow to center the div: 1. Center the div by adding the "bacbf9e1ad7f40415ce1670e31edfee3contentadca8a5fa06ffeafb062c2e3f274b930" tag; 2. Add the "margin:0 auto attribute;" to the div to automatically adjust it Centered.
The operating environment of this article: Windows7 system, HTML5&&CSS3 version, Dell G3 computer.
There are two methods for DIV centering:
1. The simple and quick method is to add the bacbf9e1ad7f40415ce1670e31edfee3contentadca8a5fa06ffeafb062c2e3f274b930 tag.
Example:
center居中 我要居中啦
2. Add the margin:0 auto attribute to the div; automatically adjust the center.
Example 2:
margin居中 我是div,我居中啦...
Recommended tutorials:html video tutorial,css video tutorial
The above is the detailed content of How to center div in html. For more information, please follow other related articles on the PHP Chinese website!