Given the following:
<main>
<h1>Hello World</h1>
<nav><button>Home</button> - <button>Contact</button> - <button>About</button></nav>
<br>
<div class=wrapper>
<b>List header</b>
<ul></ul>
</div>
</main>
How to force ul to scroll, and not overflow main nor .wrapper? I.e., the scrollbar should appear for ul, not main, nor .wrapper. Without hardcoding values.
I tried the following CSS but it fails. It would work if I was trying to scroll .wrapper, but I'm trying to scroll its child.
main {
display: flex;
flex-direction: column;
max-height: 100vh;
}
.wrapper {
flex: 1;
}
ul {
overflow: auto; /* How to force this to scroll? */
}