Am working on a relative header and sticky footer, with dynamically loaded content (sometimes an empty div (unknown height) hence height: 100vh;), all within a responsive container that adjusts to the width of the device (width: 100vw;) up to a max-width of 350px.
From there, some content loads dynamically above the header and should push down the header and the content, but should keep the sticky footer in place. The dynamic content, when it overflows, should scroll out below the header and above the footer because both are semi-transparent.
Have tried all sorts of combinations of (relative and absolute)..here's the closest one, for example: http://jsfiddle.net/9U2CU/5/.. but this combination guesses the percentage height of the dynamic content, and the content that appears is incorrectly formatted in scope and does not push down the dynamic-content because of the absolute positioning!?
What adjustments need to be made to the CSS to account for the specs?
HTML
<div id="view">
<div id="appear" style="display:none;">Content that appears</div>
<div id="header">Some Buttons</div>
<div id="dynamic-content"></div>
<div id="footer">Some Buttons</div>
</div>
CSS
#view {
position: relative;
height: 100%;
width: 100vw;
max-width: 350px;
overflow-y: auto;
height: 100vh;
display: block;
margin: 0 auto;
background-color: #fff;
}
#header {
position: relative;
height: 44px;
width: 100%;
background-color: rgba(255, 255, 255, .5);
}
#dynamic-content {
position: relative;
height: 100%;
width: 100%;
background-color: #999;
}
#footer {
position: absolute;
bottom: 0;
width: 100%;
height: 36px;
background-color: rgba(255, 255, 255, .5);
}
jQuery
$(document).on("click", "#header", function () {
$('#appear').slideToggle();
});
fixed? Also what kind of page should have 350px max width? This is a sidebar widget? (asking just out of curiosity.) - Roko C. Buljan