I'm experimenting with overlaying two divs
on top of a main div
using CSS properties like position absolute
and top
. However, I'm uncertain about the correct approach to make this responsive.
The Video SDK will insert the video stream into the main div, but it seems to have a black background that I'd like to eliminate. If I can't find another solution, my last resort is to manually hide the black sections at the top and bottom using additional divs and CSS.
Here's an example - the current view is contained in a single div, but I want to get rid of the black background at the top and bottom of the video card https://i.sstatic.net/LL0Al.jpg
My desired outcome looks like this -
https://i.sstatic.net/yn0si.jpg
I've added two divs, one at the top and one at the bottom, with a gray background. But I suspect this isn't the best way to achieve my goal. How can I ensure it stays intact even when resizing the browser window?
Code -
<div id="root" style="position: relative; display: block; max-width: 100%; text-align: center; margin-top: 10%; height: 80vh; margin-right: auto; margin-left:auto">
<!-- The Video SDK will inject the video stream here -->
</div>
<div id="hide_top" style="position: absolute;height: 12vh;width: 76vw;background: gray;top: 20%;"></div>
<div id="hide_bottom" style="position:absolute;height: 15vh;width: 76vw;background: gray;top: 54%;"></div>