I have a div wrapper which contains an iframe, and inside the iframe I have a two divs, one needs to be a fixed header and the other one should be a scrollable content. But the problem is that the whole iframe is scrollable also with the header div which should be fixed. I already tried setting the #header div to position: fixed or absolute but that is not good solution because it shows the scrollbar even on the header div. Can I have scrollbar only for the #content div?
Here is my code
file1 html:
<div id="iframeWrapper">
<iframe src="http://jsbin.com/lixegeriru" scrollable="no"></iframe>
</div>
file1 css:
#iframeWrapper {
width: 250px;
max-height: 500px;
}
iframe {
overflow: hidden;
border: 2px solid black;
width: 100%;
}
file2 html:
<div>
<div id="header">
this is a fixed header
</div>
<div id="content">
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed facilisis aliquet felis non tempor. Nam sit amet ultrices lectus. Suspendisse nibh justo, hendrerit in pulvinar ac, interdum ac orci. Quisque mollis augue nec posuere ullamcorper. Phasellus accumsan semper urna, non posuere ligula consectetur vel.
</div>
</div>
file2 css:
#header {
width: 100%;
height: 42px;
background-color: #ff4045;
color: white;
padding: 5px;
}
#content {
height: 2000px;
overflow: auto;
}
live demo here http://output.jsbin.com/wepoxetovi
EDIT: this question was marked as duplicate of HTML iframe - disable scroll
I disagree, my problem is not to hide the scrollbar, but use it only on the #content div, therefore the answer on the other questions are not related nor solving my problem.
EDIT 2: this question was again marked as a duplicate of Making a div vertically scrollable using CSS
Again, I disagree on this, because the provided answer does not solve my problem for this case.