Shopify themes, liquid, logos, and UX
We're moving the community! Starting July 7, the current community will be read-only for approx. 2 weeks. You can browse content, but posting will be temporarily unavailable. Learn more
Hi i want the video to not show on mobile but don't understand what's wrong with this code
<style>
@media screen and (min-width: 768px)
{
video {
display: block;
margin: 0 auto;
width: 100%;
height: 100%;
}
}
@media screen and (max-width: 768px)
{
video {
display: none;
}
}
</style>
<video autoplay loop playsinline muted>
<source src="https://cdn.shopify.com/videos/c/o/v/35fa068e97f84cfdb642d30b40cf7ce6.mp4"
</video>
Solved! Go to the solution
This is an accepted solution.
Hello @Zetterman 👋
You should use this code instead
<style>
video {
margin: 0 auto;
width: 100%;
height: 100%;
}
@media screen and (max-width: 768px){
video {
display: none;
}
}
</style>
<video autoplay loop playsinline muted>
<source src="https://cdn.shopify.com/videos/c/o/v/35fa068e97f84cfdb642d30b40cf7ce6.mp4">
</video>
Hope that helps!
Hi there,
Try to use !important and the end of the CSS style, as below:
video {
display: none !important;
}
Cheers!
GO Immobilier, spécialiste en Digital Marketing Suisse.
Hi @Zetterman
Try the video tutorial below to only show certain section on specific device.
This is an accepted solution.
Hello @Zetterman 👋
You should use this code instead
<style>
video {
margin: 0 auto;
width: 100%;
height: 100%;
}
@media screen and (max-width: 768px){
video {
display: none;
}
}
</style>
<video autoplay loop playsinline muted>
<source src="https://cdn.shopify.com/videos/c/o/v/35fa068e97f84cfdb642d30b40cf7ce6.mp4">
</video>
Hope that helps!
Thank you so much!
You are welcome 🙂
How about the opposite? Displaying it on mobile but not desktop? Whats the code for that?