Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
Hello, I am attempting to reduce the size of the section that contains this video I added. I have tried editing the CSS with multiple variations but I don't think I can fix this issue from there, I am pretty sure it has to be in the code.
Here is the code for the section:
<div class="section-homepage-video">
<video autoplay muted loop playsinline class="video-homepage">
<source src="https://cdn.shopify.com/videos/c/o/v/a121cf30310245f7997099b2aa6fb61b.mp4" type="video/mp4">
</video>
</div>
{% schema %}
{
"name": "Homepage Video",
"class": "index-section index-section--flush",
"settings": [],
"presets": [{
"name": "Homepage Videos",
"category": "Text"
}]
}
{% endschema %}
{% stylesheet %}
.section-homepage-video{
display: flex;
justify-content: center;
align-items: center;
height: 100vh; /* Set the height of the section to the height of the viewport */
}
.video-homepage{
width: 75%;
height: auto; /* Remove the fixed height to maintain aspect ratio */
max-width: 100%; /* Make sure the video doesn't overflow the parent div */
}
{% endstylesheet %}
{% javascript %}
{% endjavascript %}
Here is the CSS code I am using currently:
@media (max-width: 767px) {
.video-homepage {
height: auto; /* Set the height to auto to fit the video */
padding: 0; /* Remove any padding */
max-width: 100%; /* Set the maximum width to the size of the viewport */
}
.video-homepage {
width: 100%; /* Set the width to 100% to fill the parent div */
height: auto; /* Set the height to auto to maintain aspect ratio */
max-width: 100%; /* Make sure the video doesn't overflow the parent div */
}
}
}
Any help on this would be greatly appreciated, thank you.
Solved! Go to the solution
This is an accepted solution.
Hi @RoyalDesign
This is Victor from PageFly - Landing Page Builder App
You can try this code by following these steps:
Step 1: Go to Online Store->Theme->Edit code.
Step 2: Search file base.css
Step 3: Paste the below code at bottom of the file -> Save
@media screen and (max-width: 767px){
section-homepage-video {
height: 100% !important;
}
}
Hope that my solution works for you.
Best regards,
Victor | PageFly
Hi @RoyalDesign ,
Could you please share URL and your store password if it enabled? So that we can help you.
Thank you.
bedtimestoriesbook.com
This is an accepted solution.
Hi @RoyalDesign
This is Victor from PageFly - Landing Page Builder App
You can try this code by following these steps:
Step 1: Go to Online Store->Theme->Edit code.
Step 2: Search file base.css
Step 3: Paste the below code at bottom of the file -> Save
@media screen and (max-width: 767px){
section-homepage-video {
height: 100% !important;
}
}
Hope that my solution works for you.
Best regards,
Victor | PageFly
That worked for the video, thanks
Hi @RoyalDesign
We see your CSS code has not been used on the theme.
Please add the following code at the end of the styles.css file:
@media (max-width: 767px) {
.section-homepage-video {
height: auto;
padding: 0;
width: 100%;
max-width: 100%;
}
}
Here is the final result:
We hope this can help you.
If our suggestions are useful, please let us know by giving it a like, marking it as a solution, or donating here ☕.
B2B Solution & Custom Pricing | Product Labels by BSS
Need help from our expert? Kindly share your request with us via community@bsscommerce.com
this is what happens when I try to do what you said.
Am I supposed to find the file in the edit code section? Because there isn't one.
Shopify and our financial partners regularly review and update verification requiremen...
By Jacqui Mar 14, 2025Unlock the potential of marketing on your business growth with Shopify Academy's late...
By Shopify Mar 12, 2025Learn how to increase conversion rates in every stage of the customer journey by enroll...
By Shopify Mar 5, 2025