A user is trying to display different hero banner videos for mobile and desktop views in Shopify’s Savor theme but encountering issues with CSS targeting.
Initial Problem:
The user created two separate hero sections (one for mobile, one for desktop) but couldn’t get them to display conditionally using CSS media queries.
Their original code targeting hero-component didn’t work.
Solutions Proposed:
CSS class-based approach: Multiple contributors suggested adding custom CSS classes (.hero-video-mobile, .hero-video-desktop) with media queries at max-width 749px to toggle visibility.
Liquid templating: One suggestion involved using Shopify’s Liquid code to detect device type (request.device_type) and conditionally render different video elements.
Selector refinement: Later suggestions targeted .hero__media-wrapper video using :first-of-type and :last-of-type pseudo-selectors to differentiate between videos.
Current Status:
The issue remains unresolved—the user reports both videos are displaying on both screen sizes despite implementing the suggested CSS. The most recent response proposes using a .video-mobile class with display: none as default, but no confirmation of success has been posted yet.
Thank you, unfortunately this hasn’t worked. I am using two hero sections, one for mobile and one for desktop. i need them to show on different screen sizes.
Yes, it’s absolutely possible to show a different Hero banner video for mobile and desktop on the Shopify Savor theme, but there are a few important things to keep in mind:
Why Your Current Code Isn’t Working:- The hero-component is likely a custom element (not a valid CSS selector unless properly defined).
Also, Shopify themes often use dynamic components and lazy loading, so hiding elements with CSS alone might not always behave as expected.
Recommended Approach:1. Use two separate hero sections in the theme code:
One for desktop (video optimized for larger screens)
One for mobile (lighter video or image to improve speed)
Wrap each section with media query logic in Liquid or use class=“hidden” utility classes combined with media-specific CSS.