I need to display video elements in grid, where some grid will be without video element and some grid will be with video element, all the time every grid should have equal width and height.
But with below example the second and third grid have different width rest all have equal width. If I put every grid with video element then every grid have equal size, and if remove every video element grid are with equal dimension. The problem is when some grid have video element in it. How can I resolve it.
<!DOCTYPE html>
<html>
<head>
<style>
body,
html {
width: 100%;
height: 100%;
margin: 0;
padding: 0
}
.grid-container {
display: grid;
grid-template-columns: auto auto auto auto;
grid-template-rows: auto auto;
grid-gap: 8px;
background-color: #fff;
padding: 1px;
}
.grid-item {
background-color: #fafafa;
text-align: center;
padding: 0px 0;
font-size: 30px;
border: 0px solid #d2d2d7;
border-radius: 5px;
}
</style>
</head>
<body style='background: #fff;'>
<div id='mainBg' class='grid-container' style='grid-auto-flow: row;margin-top:40px;height:calc(100% - 90px)'>
<div class="grid-item">
<div style="height: 100%; width: 100%;"> </div>
</div>
<div class="grid-item">
<div style="height: 100%; width: 100%;"> </div>
</div>
<div class="grid-item">
<div style=" height: 100%; width: 100%;"> </div>
</div>
<div class="grid-item">
<div style=" height: 100%; width: 100%;">
<video width="100%" height="100%" controls>
</video>
</div>
</div>
<div class="grid-item">
<div style=" height: 100%; width: 100%;">
<video width="100%" height="100%" controls>
</video>
</div>
</div>
</div>
</body>
</html>