Can anyone help me with a CSS issue I'm experiencing in the latest versions of Chrome and Firefox? I can't seem to figure it out on my own.
The problem arises with a container div that has a 50px top margin. Inside this container, there's a sidemenu div set to 100% width. The window height is 650px, but when the content exceeds this height, both the sidemenu and container divs fail to adjust accordingly.
Interestingly, it works fine when you run the snippet, but not when you save the HTML locally and test it. I suspect there may be some StackOverflow CSS solving the issue, but I'm unsure how to identify and resolve it.
edit: Upon further investigation, I've realized that the body height matches the window size, restricting the container div. I still need guidance on how to make sure the body height expands to accommodate the full content.
https://i.stack.imgur.com/kZoyA.png
html, body {
margin: 0;
}
#container {
margin-top: 50px;
height: 100%;
background-color: lightgreen;
}
#sidenav {
width: 250px;
height: 100%;
display: grid;
background-color: green;
align-content: space-between;
}
#menu {
grid-column: 1 / 2;
grid-row: 1 / 2;
background-color: red;
}
#footer {
grid-column: 1 / 2;
grid-row: 2 / 3;
}
<html>
<body>
<div id="container">
<div id="sidenav">
<div id="menu">
sidenav<br/><br/><br/><br/><br/>
sidenav<br/><br/><br/><br/><br/>
sidenav<br/><br/><br/><br/><br/>
sidenav<br/><br/><br/><br/><br/>
sidenav<br/><br/><br/><br/><br/>
sidenav<br/><br/><br/><br/><br/>
sidenav<br/><br/><br/><br/><br/>
</div>
<div id="footer">
footer<br/>
footer<br/>
footer<br/>
footer<br/>
footer<br/>
footer<br/>
</div>
</div>
</div>
</body>
</html>