I have a div
(let's call it X) that occupies 85% of the screen and I need that within that div
other divs can be added, some contain text, other images and other videos. Each child occupies 100% of the width of the father, but the height of the father is distributed among the div
child that he has (giving the same amount of space to each one, even if one only needs 10 pixels). Any suggestions on how to carry it out?
The following code works without images, but the images break the flex container going out on the outside, any ideas?
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<style>
body {
width: 100%;
height: 100%;
box-sizing: border-box;
background-color: black;
}
#container {
width: 85%;
height: 85%;
position: fixed;
top: 0;
bottom: 0;
left: 0;
right: 0;
margin: auto;
display: flex;
flex-direction: column;
background-color: blue;
}
.elem {
border: 1px solid #BBBB1199;
flex-basis: 100%;
box-sizing: border-box;
}
</style>
</head>
<body>
<div id="container">
<div class="image elem">
<img src="https://www.hd-wallpapersdownload.com/script/bulk-upload/lion-big-wallpapers.jpg" />
</div>
<div class="elem">TEXT TEXT TEXT</div>
</div>
</body>
</html>