Dynamically Change Footer Layout Based on Device (Desktop vs Mobile)

Dynamically Change Footer Layout Based on Device (Desktop vs Mobile)

Many Shopify store owners want a footer that shows a full multi-column layout on desktop, but switches to an accordion or stacked layout on mobile.

You can do this without apps and without creating multiple footer sections. This tutorial will show you how to:

  • Create a desktop footer layout
  • Create a mobile-friendly accordion footer
  • Automatically switch between layouts using CSS or Liquid
  • Ensure content stays synced between both layouts

πŸ“Œ Method 1 β€” Easiest: Use CSS to Show/Hide Layouts Based on Screen Size

This method requires no JavaScript and works for all Shopify themes.

Step 1 β€” Duplicate your footer layout

Inside footer.liquid, wrap your current footer with a desktop-only container:


Now create a mobile version (accordion is recommended):


Step 2 β€” Add CSS to control visibility

In theme.css or base.css:

/* Desktop footer visible only on large screens */
.footer-desktop {
  display: block;
}

.footer-mobile {
  display: none;
}

/* Switch visibility on mobile */
@media(max-width: 767px) {
  .footer-desktop {
    display: none;
  }
  .footer-mobile {
    display: block;
  }
}

Now your footer automatically swaps between layouts depending on the screen size.


πŸ“Œ Method 2 β€” Add Mobile Accordion Behavior (Optional)

For interactive mobile footers, add this JavaScript.

Add to footer.liquid or before

Back to blog

Leave a comment