I'd like to have on an HTML page:
- header div - some height, based on its contents
- content div (below header) - take the rest of the height below header
- table (in content div) - take 100% for both dimensions of its parent (content div)
- video item (in table) - take and reserve 100% for both dimensions of its parent (td)
Here is what I have:
body { margin: 0; }
#main {
position: absolute;
left:0px;
top:0px;
display: flex;
flex-direction: column;
height: 100vh;
width: 100vw;
background:red;
}
#header {
background:yellow;
}
#content {
background:gray;
flex:1;
}
table {
width: 100%;
height: 100%;
background: blue;
color: white;
}
video {
width: 100%;
height: 100%;
}
<html>
<body>
<div id="main">
<div id="header">
Header
</div>
<div id="content">
<table>
<tr>
<td>
<video controls>
<source src="https://test-videos.co.uk/vids/bigbuckbunny/mp4/h264/1080/Big_Buck_Bunny_1080_10s_1MB.mp4" type="video/mp4">
</video>
</td>
</tr>
</table>
</div>
</div>
</body>
</html>
Now, the problem is with the video tag (if you run this snippet there will be scrollbars - I don't want them).
If I remove the video tag, everything works as intended. However, if there is the video tag, it ruins the 'flex' option: it enlarges the td, hence the table becomes also larger and then the content also - so scrollbar(s) are enabled and the page won't fit into the screen.
Maybe the video is resized when the media is loaded, and at that time all css operations are finished.
But what is the way to make the video to be the exact same size as 100% width and height of its parent (the td) even during playback?