Skip to main content
All CollectionsTroubleshooting and FAQsFrequently Asked QuestionsGeneral
How to Add YouTube as a Section's Background Video
How to Add YouTube as a Section's Background Video

Learn how to add a YouTube video as a background in Divi, enhancing your site’s visual appeal and creating an immersive user experience.

Updated over a week ago

Adding a YouTube video as a background to your website sections can significantly enhance your site's visual appeal and engagement.

Using a dynamic video background can convey your message more effectively and create a more immersive experience for visitors.

This article will guide you through the steps to seamlessly integrate a YouTube video as a section’s background in Divi, ensuring it plays smoothly and enhances your site’s design.

Only self-hosted videos can be used as video backgrounds. However, you can create a section with a YouTube video background by following the steps below.

  1. Insert a new Row into the Section's layout.

  2. Open the Row's settings, go to the Design Tab, and make the following changes:

    1. Sizing → Enable the Use Custom Gutter Width.

    2. Set the Gutter Width to 1.

    3. Set the Width to 100%.

    4. Set the Max Width to 100%.

    5. Set the Top Padding to 0.

    6. Set the Bottom Padding to 0.

  3. Go to Advanced Tab → Position and choose Absolute position.

  4. Insert the Code module in this new Row.

  5. In the Code module, place the following HTML code:

    <iframe width="560" height="315" src="https://www.youtube.com/embed/hN2LfPgbY1g?autoplay=1&mute=1&controls=0&loop=1&playlist=hN2LfPgbY1g&modestbranding=1&showinfo=0" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe>

  6. Replace the YouTube video ID hN2LfPgbY1g (in both instances) with the video ID you want to use.

Important Notes:

  1. Autoplay Policy: Modern browsers have restrictions on auto-playing videos with sound. The ?autoplay=1&mute=1 in the URL ensures the video auto-plays in a muted state.

  2. Performance: Background videos can affect your website's performance and loading time, especially on mobile devices.

  3. Permissions: Make sure you have the right to use the video as a background for your website.

  4. Because the row containing the Code module with the YouTube embedded code is positioned absolute, you can easily edit other elements from the same section using the Wireframe View or the Layers View.

The background video will be as shown in the GIF below:

Did this answer your question?