I am attempting to create a layout similar to this
https://i.sstatic.net/Y1FCp.png
My goal is to:
- Have two main divs positioned side by side inside a wrapper div
- Ensure the wrapper expands to fill 100% of the browser size
- The left div (banner) should be fixed and overlayed, acting as a vertical navigation container. When the list of items exceeds the visible area without scrolling, the div should expand in height accordingly
- The right div (content) should have overflow:auto so that if its content exceeds the allowed height (browser height), users can scroll down to view the rest while keeping the left div fixed in place
I've spent some time working on a solution, here is what I have come up with so far:
<style>
html, body {
height: auto;
}
#wrapper {
overflow: hidden;
height: 100%;
}
div#banner {
width: 35%;
float: left;
padding-bottom: 1000px;
margin-bottom: -1000px;
overflow:hidden;
height:100%;
background: rgba(0, 0, 0, 0.74);
z-index: 999;
}
div#content {
width: 65%;
float: left;
background-color: grey;
padding-bottom: 1000px;
margin-bottom: -1000px;
overflow:auto;
background: blue;
height:100%;
color:white;
}
</style>
<div id="wrapper">
<div id="banner">
<header>
header content
</header>text<br>text<br>text<br>text<br>text<br>text<br>text<br>text<br>text<br>text<br>text<br>text<br>text<br>text<br>text<br>text<br>text<br>text<br>text<br>text...
</div>
<div id="content" style="">
right
text<br>text<br>text<br>text<br>text<br>text<br>text<br>text<br>text<br>text<br>text<br>text<br>text<br>text<br>text<br>text<br>text<br>text<br>text<br>text<b...
</div>
</div>
(update) https://jsfiddle.net/nze5ug5t/5/
Is there a better way to achieve this layout?