E-commerce

What are the essential HTML codes for e-commerce merchants?

What are the essential HTML codes for e-commerce merchants?

October 29, 2026

Are you wondering what essential HTML codes are needed to boost your online store?

A small number of tags allow you to enrich your pages, improve the user experience, and increase conversions.

It is enough to know the right attributes and apply them correctly to avoid slowdowns and display errors.

Beyond the visual aspect, each tag plays a role in SEO, accessibility, and performance that directly influences your bounce rate and revenue.

So, what are the essential HTML codes for e‑commerce merchants? Here is the program:

  • How to integrate an optimized image?

  • How to add a border or style to an image?

  • How to turn an image into a clickable link?

  • How to create a text link that opens in a new window?

  • How to align text and images for a coherent design?

  • How to configure high-performing CTAs without JavaScript?

  • How to enrich products with schema.org markup?

  • How to collect email addresses with a minimalist form?

  • How to integrate Shopify's native add-to-cart button?

  • How to display customer reviews semantically?

  • How does Qstomy automate code compliance?

  • What checklist to apply before publishing a product page?

Let's go.

Summary

How to integrate an optimized image on a product page?

The element <img> is the basis for displaying an image. The minimal syntax is:
<img src="URL_DE_LIMAGE" alt="Texte alternatif">

Before inserting your visual, remember to compress it (JPEG or WebP) so it loads in under a second. The attribute src indique l’adresse de l’image, tandis que alt provides essential alternative text for accessibility and SEO.

You can control the size with width and height (en pixels). Exemple : width="200" height="137". If you need white space around it, use hspace and vspace (ex. hspace="5" vspace="5").

For advanced performance, add loading="lazy" so the image only loads when it enters the viewport, and srcset with multiple versions for retina display. The attribute align allows you to place the image on the left, right, or center (align="right"). For more details on the technical requirements of an e‑commerce site, consult What do we need for an e‑commerce site?

Convert over 2,000 customers on average per month with Qstomy.

The world’s 1st Shopify AI dedicated to customer conversion

Empowering 200+ e-commerce merchants

How to add a black border around an image?

To visually frame an image, simply add the attribute border to the same tag <img>. The value represents the thickness in pixels.

Exemple :
<img src="photo.jpg" alt="Produit" border="1">

A border of 1 pixel gives a subtle look, ideal for not cluttering the page. If you choose 10, the border will be very thick and attract the visitor's attention.

Instead of the HTML attribute, you can also apply a CSS class (.bordered{border:2px solid #000;}) to keep the style separate from the markup. Remember to test the display on mobile, where a border that is too wide can hinder reading, and use media queries to adjust the thickness based on resolution.

How to turn an image into a clickable link to an external page?

Simply wrap your tag <img> in an anchor tag <a>. The structure becomes:

<a href="/en/blog-posts/URL_DESTINATION" target="_blank" rel="noopener"><img src="photo.jpg" alt="Texte"></a>

L’attribut href indicates the destination, target="_blank" opens the link in a new tab, thus avoiding losing the visitor on your store. The rel="noopener" prevents the new page from accessing the original window, enhancing security.

If you do not wish to open a new tab, simply remove target="_blank". This gesture is useful for partners or complementary resources, where you want to keep the user in the same navigation flow.

How to create a text link that directs to a product page?

A clickable text is created with the same tag <a>, but without the image. Example:

<a href="/blog-posts/which-free-website-builder-is-best-for-ecommerce">View product</a>

By default, the link opens in the same page. To open a new window, add target="_blank" after the URL. Remember to add rel="noopener" for the same security reason as before.

For SEO, choose a descriptive anchor text, optionally use an attribute aria-label if the label must remain short, and ensure the link is relevant for internal linking. Text links are essential for internal linking and SEO. Learn more about category SEO strategies here: E-commerce SEO strategy for category pages.

How to align text and image for a consistent design?

L’attribut align of the image (left, right, middle) allows placing the text around. Example:

<img src="photo.jpg" alt="Produit" align="left">Lorem ipsum dolor sit amet, consectetur…

The text wraps automatically around the image. For a finer layout, combine align with margins via hspace and vspace. You can also replace align with a container div using flexbox or grid for total control over breakpoints.

This mixed approach avoids excessive use of CSS while remaining compatible with older browsers and mobile devices, ensuring your pages remain functional even without JavaScript.

How to insert a call-to-action button with simple HTML?

A CTA button is quickly created by transforming a link into a button using the attribute style or a class. Basic example:

<a href="/blog-posts/which-platform-is-best-for-creating-ecommerce-website" class="btn" style="display:inline-block;padding:10px 20px;background:#ff6600;color:#fff;text-decoration:none;border-radius:4px;">Add to cart</a>

The text "Add to cart" clearly indicates the expected action. You can adjust the color, border radius, and padding to fit your brand guidelines.

For optimal semantics, use the tag <button> with an attribute data-cta="add-to-cart" and style it via CSS. This simplifies navigation for screen readers. To automate CTA creation, Qstomy offers ready-to-use templates in the Shopify dashboard.

How to add structured data (schema) for products?

Search engines understand your products better with JSON-LD markup. Insert it within the tag <script type="application/ld+json"> in the page head.

https://example.com/photo.jpg

This information allows SERPs to display rich snippets (price, availability, reviews), increasing the click-through rate. Ensure you update the JSON-LD whenever stock or price changes, and test it with Google's Rich Results Test tool.

For a complete guide, consult How to optimize an e-commerce site for Google.

How to integrate a newsletter signup form?

A small form <form> can be added wherever you like. Minimal example:

<form action="/newsletter/inscription" method="post"> <input type="email" name="email" placeholder="Your email" required> <button type="submit" style="background:#0066cc;color:#fff;padding:8px 12px;">Sign up</button> </form>

Make sure to use the field type="email" to benefit from native browser validation. Add a hidden field honeypot (type="text" style="display:none") to reduce spam. You can connect the form to your email service or to Qstomy, which automates subscriber tracking.

N’oubliez pas d’inclure l’attribut aria-label="Newsletter Signup" for accessibility, and declare GDPR consent if necessary.

How to include a Shopify-compatible add-to-cart button?

Shopify offers a very simple add-to-cart form. Here is the basic code:

<form action="/cart/add" method="post"> <input type="hidden" name="id" value="1234567890"> <button type="submit" class="btn" style="background:#28a745;color:#fff;padding:10px 20px;">Add to cart</button> </form>

L’identifiant id corresponds to the product variant. When the customer clicks, the product is added to the cart without leaving the page thanks to AJAX (already integrated in Shopify). You can enhance the experience by adding the class ajax-add-to-cart and displaying the cart drawer with a small JavaScript snippet provided by Shopify.

Finally, remember to include data-quantity="1" to set the default quantity and handle stock errors via the API's JSON response.

How to create a customer reviews section with HTML markup?

Reviews build trust. A simple block uses the tag <blockquote> with the customer's name.

<blockquote> <p>Very good quality product, fast delivery.</p> <footer>, Marie Dupont</footer> </blockquote>

Ajoutez l’attribut cite if you want to reference the source. By combining this block with the Qstomy module, reviews are automatically synchronized with your dashboard. For better SEO, enrich reviews with the markup Review de schema.org : Very good quality product, fast delivery..

This format allows search engines to display stars in results, thereby increasing perceived credibility.

How does Qstomy help optimize these HTML tags for conversion?

Qstomy, your AI assistant dedicated to Shopify, analyzes each product page and suggests the most effective HTML tags. It detects unoptimized images, proposes relevant attributes alt and automatically adds structured data tags.

Thanks to its recommendation engine, Qstomy inserts personalized CTAs, adjusts external links in target="_blank" and creates review sections ready to be published. You save time and improve your conversion rate without touching the code.

The tool also integrates with analytics platforms (Google Analytics, Facebook Pixel) by automatically injecting events add_to_cart and purchase. Thus, every tag modification is immediately traceable and measurable.

Integrate Qstomy into your Shopify dashboard and let it manage HTML updates continuously.

What HTML checklist before publishing a product page?

In short

  • Image : correct src, descriptive alt, compressed format, consistent dimensions.

  • Lien : href valide, target="_blank" si besoin, texte d’ancre pertinent.

  • Bouton CTA : visibility, contrasting color, action-oriented label.

  • Structured Data : complete JSON-LD, price, availability, SKU, reviews.

  • Accessibility : alt texte, contraste couleur, navigation clavier.

FAQ

  • Should I always specify width and height? Yes, this prevents re-flow during image loading.

  • How to prevent my images from slowing down the site? Compress them, use the WebP format, and serve them via a CDN.

  • Can Qstomy automatically fix my tags? Yes, the AI suggests fixes and can apply them with one click.

Before going live, run your product page through Lighthouse to check performance, accessibility, and SEO scores. Fix the warnings, then validate the rendering on different devices before publishing.

To go further: Can you use Wix for an e-commerce site? - Qstomy, Feedback loop: follow feedback to optimize your products - Qstomy.

Enzo

October 29, 2026

Convert over 2,000 customers on average per month with Qstomy.

The world’s 1st Shopify AI dedicated to customer conversion

Empowering 200+ e-commerce merchants

Subscribe to the newsletter and get a personalized e-book!

No-code solution, no technical knowledge required. AI trained on your e-shop and non-intrusive.

*Unsubscribe at any time. We do not send spam.

Subscribe to the newsletter and get a personalized e-book!

No-code solution, no technical knowledge required. AI trained on your e-shop and non-intrusive.

*Unsubscribe at any time. We do not send spam.