{"id":328311,"date":"2020-12-08T07:47:11","date_gmt":"2020-12-08T15:47:11","guid":{"rendered":"https:\/\/css-tricks.com\/?p=328311"},"modified":"2020-12-08T07:47:13","modified_gmt":"2020-12-08T15:47:13","slug":"overlaying-video-with-transparency-while-wrangling-cross-browser-support","status":"publish","type":"post","link":"https:\/\/css-tricks.com\/overlaying-video-with-transparency-while-wrangling-cross-browser-support\/","title":{"rendered":"Overlaying Video With Transparency While Wrangling Cross-Browser Support"},"content":{"rendered":"\n

As websites are becoming more and more dynamic when it comes to design, there is sometimes a need to incorporate complex, animated elements. There are many ways to do that from CSS transitions to 3D rendering on canvas, and animated SVG. But it is often easier to use a <video><\/code> since they can be rather efficient and, with them, just about anything visual is possible.<\/p>\n\n\n\n

But what if you a need transparent background on that video, so that it could overlay and appear to interact with other content on the page? It\u2019s possible, but can be tricky, especially cross-browser. Let\u2019s explore that.<\/p>\n\n\n\n\n\n\n

Here\u2019s an example<\/h3>\n\n\n

To see how transparent video overlays work, I\u2019ve prepared an example that I hope feels both fun and relatable. The idea is to integrate video with interactive content underneath so that the content behind the video changes as the slider is advancing. It is a slider advertising dog food with a real video of a dog on the overlay and I\u2019m sure that realistic, cute dog would improve the conversion rate!<\/p>\n\n\n\n