" to define the icon; and finally use the "align="center"" attribute to center the image."/> " to define the icon; and finally use the "align="center"" attribute to center the image.">

Home>Article>Web Front-end> How to center the picture in html

How to center the picture in html

藏色散人
藏色散人 Original
2021-04-12 09:28:47 45092browse

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.

How to center the picture in html

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.

How to center the picture in html

Create a new html document.

How to center the picture in html

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.

How to center the picture in html

At this time, useto define the icon and put the link to the image in src.

How to center the picture in html

Check it out, the picture will be on the left by default.

How to center the picture in html

At this time, in order to distinguish it from other parts, we can define a separate area for the picture, just use div.

How to center the picture in html

Then we add align="center" to the div and save the file.

How to center the picture in html

When you open the HTML file, you will find that the image is centered.

How to center the picture in html

HTML video tutorial

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!

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