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
I want to change the aspect ratio of my video to match the landscape box of it. What code do I require in the CSS section? I want the video to be an auto loop, and it starts as soon as the landing page loads.
Could you please share your store URL and password [if applicable] so that I can take a look and provide you solution code.
Looking forward to hearing back from you.
Thanks
Hi there! Hope you are well.
Ian here from Fast Bundle.
The general code is here but you must customize it based on your theme and it's elements.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Video Landing Page</title>
<style>
/* Full screen layout */
body, html {
margin: 0;
padding: 0;
height: 100%;
display: flex;
justify-content: center;
align-items: center;
background-color: #000; /* optional background */
}
/* Landscape box */
.video-container {
width: 80vw; /* 80% of viewport width */
aspect-ratio: 16 / 9; /* landscape aspect ratio */
overflow: hidden;
position: relative;
border-radius: 10px; /* optional rounded corners */
box-shadow: 0 0 10px rgba(0,0,0,0.5);
}
.video-container video {
width: 100%;
height: 100%;
object-fit: cover; /* makes sure video fills container while keeping aspect */
}
</style>
</head>
<body>
<div class="video-container">
<video autoplay loop muted playsinline>
<source src="your-video.mp4" type="video/mp4">
Your browser does not support the video tag.
</video>
</div>
</body>
</html>