Having trouble with setting height to 100%.
I have a list of items that need to be distributed to match the height of the side image. It works fine when I use a fixed height, but not with a percentage.
The issue arises because the website is responsive and I cannot set a fixed height since the image isn't fixed.
Here's the code snippet:
<!DOCTYPE html>
<html>
<head>
<title>testing flex box</title>
<style>
html,body {
min-height: 100% !important;
height: 100%;
}
body { margin: 0 }
* { box-sizing: border-box }
.container {
width: 600px;
margin: auto;
}
.row {
clear: both;
margin: 0 -15px;
overflow: auto;
}
.lateral, ul {
width: 50%;
float: left;
padding: 0 15px;
}
img {
width: 100%
}
ul {
list-style: none;
margin: 0;
display: flex;
flex-direction: column;
justify-content: space-between;
height: 356px; /* works */
height: 100%; /* not working */
}
ul li {
height: 50px;
background: darkred;
}
</style>
</head>
<body>
<div class='container'>
<div class='row'>
<div class='lateral'><img src='https://placeholdit.imgix.net/~text?txtsize=33&txt=285%C3%97356&w=285&h=356'></div>
<ul>
<li>item 1</li>
<li>item 2</li>
<li>item 3</li>
<li>item 4</li>
<li>item 5</li>
</ul>
</div>
</div>
</body>
</html>
Any insights on what might be causing this issue? Thank you.