Under the hood · 20 November 2026

Shopify page transitions with three lines of CSS, and where that stops

The browser can cross-fade between the pages of a Shopify theme with three lines of CSS. How to add them, how to shape the move, how to fly a product photo, and what CSS alone cannot do.

Since 2024, browsers can animate between two ordinary pages of the same site with no JavaScript at all. A Shopify theme is exactly that kind of site, so the simplest page transition a shop can have is free. This is how to add it, and an honest list of what it will not do.

The three lines

In your admin, open Online Store, Themes, Edit code, and find the theme’s main stylesheet (assets/base.css on Dawn). At the end of the file, add:

@view-transition {
  navigation: auto;
}

Save, open the shop in Chrome, Edge, or Safari 18.2 or newer, and click a link. The old page now cross-fades into the new one. That is the whole feature: both pages have to opt in, every page of a theme loads the same stylesheet, and the browser does the rest. Firefox does not play these yet; it ignores the rule and loads pages as before, so nothing breaks.

Respect reduced motion

Some visitors ask their device for less motion. Wrap the rule so they get none:

@media (prefers-reduced-motion: no-preference) {
  @view-transition {
    navigation: auto;
  }
}

Shape the move

The browser takes a picture of the old page and a picture of the new one, and animates between the two. Each picture has a name you can style:

::view-transition-old(root) {
  animation: 0.25s ease-in both leave;
}
::view-transition-new(root) {
  animation: 0.4s ease-out both arrive;
}
@keyframes leave {
  to { opacity: 0; }
}
@keyframes arrive {
  from { opacity: 0; transform: translateY(24px); }
}

Here the old page fades out and the new one rises into place. Keep it under half a second; the visitor is waiting for it to finish.

Fly a product photo

Give one element on each page the same view-transition-name and the browser moves it from its old box to its new one. For a product photo that means the image on the product card and the main image on the product page. On Dawn the card is snippets/card-product.liquid; add the name to its image with the product’s id, so every card has its own:

style="view-transition-name: product-{{ card_product.id }}"

and on the product page’s main image:

style="view-transition-name: product-{{ product.id }}"

The rule that catches everyone: a name must be unique on a page. If the same product appears twice, in a featured row and again in the grid, two elements share a name and the browser skips the whole transition. Sliders and lazy-loaded galleries make this harder than it looks.

Where CSS alone stops

When an app makes sense

If a cross-fade is what you want, the three lines are enough, and you should use them. If you want a move that holds your colours and your logo while the page loads, that takes a cover, and that is what Segue adds: fourteen of them, picked in the theme editor, with nothing in the theme’s code edited. It still uses the browser’s own transition for the one move it is best at, the product photo flight.

Curve, in a demo shop: a cover in the shop’s colours, which is the part the three lines of CSS cannot draw.

There is more on the browser feature in The View Transitions API and Shopify, and the three ways to add transitions are compared in How to add page transitions to a Shopify store.