How to center images in webpages

Align using div tag

In this case the image is always at the center of the page. The size of my image is set to 50%. When my browser window is resized the image size changes as well. Try it!

Align with the align attribute for img

In this case the image will appear in the middle of the paragraph text. If I have a lot of text, the text will be wrapped around the image. If the image cannot fit in the middle of the text, it will be moved to a new line. Also, if the browser window is resized, the text will be placed in the middle of the text if possible. Some of this text will appear at the top of the image

Here is the code view Code to center images