To add a background video to your Webflow site using custom code, you can follow these steps:
1. Prepare your video: Convert your video file to a format supported by web browsers, such as MP4, WebM, or Ogg. Optimize the video by compressing its size and resolution to ensure faster loading times.
2. Upload the video: In your Webflow project, go to the Assets panel and upload the video file. Once uploaded, copy the URL of the video file.
3. Add a new collection: Create a new collection by going to the Collections panel and clicking the "+ New Collection" button. Give it a name and add any necessary fields. This step is necessary to add a custom code to your project.
4. Add a custom code field: In the Collection settings, go to the `Custom` tab and click on `+ Add Field`. Choose `Plain Text` as the field type and give it a name like "Background Video".
5. Apply the collection to a page: Go to the Pages panel and choose the page where you want to add the background video. In the Settings of that page, scroll down to the Collection section and select the collection you created in step 3.
6. Add custom code: In the Designer, go to the page where you want to add the background video. Drag a `Div Block` onto the canvas and make sure it covers the entire page. Then, give it a unique class name in the Class panel.
7. Custom code embed: Select the `Div Block` and click on the `+ Add Field` button in the right-side panel. Choose the `Custom Code` option. Now, paste the following code into the code field:
```html