I added a video to my homepage. Uploaded video to files and used this liquid code.
<div class="container"______What can I add to make it centered?
website: www.jjpromotions.ca
I added a video to my homepage. Uploaded video to files and used this liquid code.
<div class="container"______What can I add to make it centered?
website: www.jjpromotions.ca
Hi, @jjpromotions
You can try this code
.section-template--14496534593603__1661982991c2184d41-padding{
text-align-last: center;
padding-top: 20px;
}
plz, try to paste the code into the theme.liquid file within the head section
400px = video width
If it helps you please click on the “like” button and mark this answer as a solution!
Thank you.
Kind regards,
Diego
Woohooo Your awesome!! Thank you
Ok, I have spent the last 24 hours digging through code variations and FINALLY FOUND IT!
THIS is what you have to do to center a video in the new “video-homepage” section that you add.
Add this first part to the CSS style sheet for the video-homepage section, then make your code for the whole section the last bit of code. I have probably tried 20 variations, broke my page, fixed, it, broke it again, then fixed it and figured this sh*t out.
To center the .video-homepage div and the video-homepage element within it, add the following CSS to your stylesheet:
.video-homepage{
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 */
}
![]()
This will use flexbox to center the content both horizontally and vertically within the video-homepage div. The height: 100vh sets the height of the section to be the full height of the viewport. The max-width: 100% ensures that the video doesn’t overflow the parent div and remains responsive.
Your updated code will look like this:
arduino
REPLACE ALL CODE IN “VIDEO-HOMEPAGE.LIQUID” SECTION WITH THIS:
{% 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 %}