Please help me replacing the background image for this section with a video background (URL: /wp-content/uploads/2025/05/Celestial-Website-Video-V1.mp4):
Assistant
To replace the background image with a video background for your section, you can embed a <video> element inside the section and adjust the CSS so the video fills the background and stays behind the content.
Here’s a modified version of your section code with the video background using the provided video URL:
php
<section id="cbc-header" class="px-3 py-4 p-lg-5 position-relative overflow-hidden">
<!-- Video background -->
<video autoplay muted loop playsinline class="position-absolute top-0 start-0 w-100 h-100" style="object-fit: cover; z-index: -1;">
<source src="/wp-content/uploads/2025/05/Celestial-Website-Video-V1.mp4" type="video/mp4">
Your browser does not support the video tag.
</video>
<div class="container position-relative z-front mb-4 mb-lg-5">
<div class="row text-center">
<div class="col-12">
<img src="<?php echo bcb_image_url(31);?>" alt="Celestial Body Care Co." class="w-100" style="max-width: 800px;"/>
</div>
</div>
</div>
<div class="overlay z-back"></div>
<a href="#cbc-service">
<img src="<?php echo bcb_image_url(34);?>" alt="Arrow Icon" class="position-absolute bottom-0 z-front start-50 mb-5 cbc-arrow"/>
</a>
</section>
Explanation and notes:
Removed the inline background image style from the <section>.
Added a <video> element set to autoplay, muted (important for autoplay to work without user interaction), loop, and playsinline for mobile support.
Used CSS classes and inline styles on the video:
position-absolute top-0 start-0 w-100 h-100 to make it cover the entire section.
object-fit: cover to ensure it scales nicely and covers the area without distortion.
z-index: -1 to push it behind the content.
Added overflow-hidden on the section to hide any overflow from the video.
The .overlay.z-back div remains — if it’s some opacity overlay, it will stay on top of the video but behind the content.
Ensure your .z-front and .z-back classes are properly defined in CSS to handle stacking order:
Test on various screen sizes and browsers, especially mobile devices, as autoplay policies can affect how videos play.
If you want to fallback to an image in case the video doesn't load, you could either use the <video>poster attribute or add a CSS background image as a fallback.
Let me know if you want me to help with that or anything else!