I searched all around, but I can’t solve it, so I’m moving here.
I want to create a layout that looks like this:

The layout consists of three fields:
Header at the top with a fixed height, dynamic width and vertically scrollable content.
The body under the heading, with dynamic width and height, with vertically scrollable content.
Sidebar on the right, with a fixed width, dynamic height and no scroll. (This should remain fixed while scrolling through the contents of the body)
Dynamic height and / or width means that it will be resized using the window, rather than resizing the content.
If something is unclear or there are any questions, I will do my best to answer.
edit: one of my (very unsuccessful) attempts: http://jsfiddle.net/uYTht/34/
Structurehtml:
<body>
<div id="header">
header content
</div>
<div id="content">
body content
</div>
<div id="sidebar">
sidebar content
</div>
</body>
Css code:
#header {
width: 100%;
height: 100px;
margin-right: 150px;
background-color: green;
overflow-y: scroll;
}
#content {
background-color: blue;
height: 100%;
overflow-y: scroll;
}
#sidebar {
position: absolute;
top: 0;
left: 100%;
margin-left: -150px;
width: 150px;
height: 100%;
float: right;
background-color: red;
overflow: hidden;
}
edit: David below helped me find the way. Basically, what I had to use to make it work the way I wanted was the calc () function.
edit edit: Jack below came up with a solution that did not use calc (), which I have to say what I prefer. Thank you very much for your help!
source
share