Should I use a <div> tag or a <p> tag to center an image on a product page?

dangkhiem
Shopify Partner
18 0 3

When creating a product, in the editor there are 2 ways to center an image in the content.
First way: Insert the image into the article, then place the mouse cursor next to the image and select center in the alignment section. When switching to HTML, there will be an <img> tag inside a <p> tag

screenshot_1709219215.pngscreenshot_1709219465.png
Method 2: insert an image into the article, then double-click on the image and check the center alignment. When switching to HTML, there will be an <img> tag inside a <div> tag

screenshot_1709219242.pngscreenshot_1709219465-2.png
So I would like to ask, what method should I use to optimize SEO and page loading speed?
In addition, in case there are products I forget to center the image, I added a custom CSS code to the product page in the theme, the CSS code is as follows:
img {
display: block;
margin-left: auto;
margin-right: auto;
}
I would like to ask, does adding this custom CSS code have any effect on SEO and page loading speed?
Thank you!

Replies 0 (0)