How to center the page horizontally in the picture by CSS
This article is about how CSS makes the level of the web page in the picture center. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.
Use CSS to center the level of the page in the picture:
Text-align:center
Introduction to pattern centered text-align:center:
Text-align:center is the central utility in the form of degree, and the picture on the hook page is introduced using the img tag, so to make the picture in the middle, it is only necessary to set this level to the picture parent (one level above) to center the CSS.
1. Set the image level in div to center an example.
1. CSS code
Div {width:400px; height:110px;text-align:center}
This sets the image in the div to be centered.
2. Html code
3. Screenshot of an example where the image level is in the middle.
Screenshot of an example where the img image is centered within the div
Second, set the center for the picture in the specified class object
1. CSS code
.exp {width:300px; height:80px;text-align:center}
To see the center of the picture, configure the width and height of the object
2. HTML form code
3. Screenshot of efficacy
The picture is in the middle as content.
Thank you for reading! This is the end of the article on "how to center the web page in the picture". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it for more people to see!