I created a custom liquid section for my home page in my Dawn theme to display a video(the video was uploaded to my store files, not from Youtube), below is the code :(the code was from some where on internet, I know only a bit about coding)
The problem is that the video looks fine on desktop, but a little too small on mobile, if I change the width from 50% to 100%, then it looks good on mobile, but way too big on desktop.
My question is; how to separate the video for desktop and mobile individually? The ideal width is 50% for desktop; 100% for mobile.
Hi Billy, use css media queries to trigger different video widths depending on the user’s current viewport width.
/*mobile - small tablets*/
video {
width: 100%;
}
/* any screen equal to or wider than 768px */
@media only screen and (min-width: 768px) {
video {
width: 50%;
}
}
The overall general technique is called Responsive Design and it takes a lot of research/practice to master it but is mainly a thing you can accomplish with a good designer and, as a dev, good knowledge of CSS. Here is an introduction!
How is this a solution ? Is this the customised liquid code to input on a shopify page ? Because I tried that and it doesn’t help with anything. If this a partial code, then where is the rest ?