" to define the icon; and finally use the "align="center"" attribute to center the image.">
htmlHow to center the image: First create an HTML sample file; then use "" to define the icon; finally use "align="center"" Just set the attribute to center the image.
The operating environment of this article: Windows7 system, HTML5&&CSS3 version, Dell G3 computer.
Open the code editor, here we use ATOM as an example.
Create a new html document.
First we need to define the HTML format, and then define the basic structure of the entire document. Pay attention to separate HEAD and BODY.
At this time, useto define the icon and put the link to the image in src.
Check it out, the picture will be on the left by default.
At this time, in order to distinguish it from other parts, we can define a separate area for the picture, just use div.
Then we add align="center" to the div and save the file.
When you open the HTML file, you will find that the image is centered.
The above is the detailed content of How to center the picture in html. For more information, please follow other related articles on the PHP Chinese website!