Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to add headers to independently scrollable divs without pushing beyond height of window?
    primarykey
    data
    text
    <p>I've found another post that gets me really close to what I'm looking for, but not all the way. (http://stackoverflow.com/questions/10474354/layout-with-fixed-header-and-footer-fixed-width-sidebar-and-flexible-content)</p> <p>Essentially I want to add a header/title section to each scrollable area. These shouldn't scroll within their respective sections though. Here's the jsfiddle, and I've commented out the header sections. When they're added, it pushes the div beyond the height of the window, expanding the content. Any help is appreciated!</p> <p>Here's original code:</p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;meta http-equiv="content-type" content="text/html; charset=utf-8" /&gt; &lt;title&gt;Application Wireframe&lt;/title&gt; &lt;style type="text/css"&gt; body { margin: 0; height: 100%; } #header { text-align: left; background: #4f0f00; color: #fff; width: 100%; margin: 0 0 0 0; border: 0; overflow: hidden; position: fixed; } #accountbar { background-color: #000000; color: white; height: 40px; width: 100%; } #contextbar { position:fixed; top:40px; width: 100%; } #leftheader { background-color: #66CCFF; height: 40px; width:200px; float:left; } #contentheader { background-color: #996600; color: white; height: 40px; } #middle { position:fixed; top:80px; width: 100%; height: 100%; } #left_col { float: left; width: 200px; /*height: 100%;*/ } #left_col_wrap { /*width: 100%; height: 100%; position: fixed;*/ } #leftnav { background-color: #66FFFF; height: 100%; overflow: scroll; /*width: 200px;*/ } #main_col { /*margin-left: 200px;*/ /*height: 100%;*/ } #main_content_wrap { /*position:fixed; width:100%; height: 100%;*/ } #messagegap { background-color: white; } #contentpane { background-color: #FFAA00; height: 100%; overflow: scroll; } #contentfoot { background-color: #C80; height: 20px; position: fixed; width: 100%; bottom: 0; padding-bottom: 18px; } #footer { background-color: #CCCCCC; clear: left; width: 100%; position: fixed; bottom: 0; } &lt;/style&gt; &lt;/head&gt; &lt;body&gt; &lt;div id="header"&gt; &lt;div id="accountbar"&gt;&lt;b&gt;Account Bar&lt;/b&gt; -always visible-this is the main page -- everyone else stay thin so we can see this this is the main page -- everyone else stay thin so we can see this this is the main page -- everyone else stay thin so we can see this&lt;/div&gt; &lt;/div&gt; &lt;div id="contextbar"&gt; &lt;div id="leftheader"&gt;&lt;b&gt;Left Header&lt;/b&gt;&lt;/br&gt;-usually says "Contents"-&lt;/div&gt; &lt;div id="contentheader"&gt;&lt;b&gt;Content Header&lt;/b&gt; -always visible- this is the main page -- everyone else stay thin so we can see this this is the main page -- everyone else stay thin so we can see this this is the main page -- everyone else stay thin so we can see this&lt;/div&gt; &lt;/div&gt; &lt;div id="middle"&gt; &lt;div id="left_col"&gt; &lt;div id="left_col_wrap"&gt; &lt;div id="leftnav"&gt;&lt;b&gt;Left Navigation&lt;/b&gt; &lt;ul&gt; &lt;p&gt; First&lt;/p&gt; &lt;p&gt; left&lt;/p&gt; &lt;p&gt; left&lt;/p&gt; &lt;p&gt; left&lt;/p&gt; &lt;p&gt; left&lt;/p&gt; &lt;p&gt; left&lt;/p&gt; &lt;p&gt; left&lt;/p&gt; &lt;p&gt; left&lt;/p&gt; &lt;p&gt; left&lt;/p&gt; &lt;p&gt; left&lt;/p&gt; &lt;p&gt; left&lt;/p&gt; &lt;p&gt; left&lt;/p&gt; &lt;p&gt; left&lt;/p&gt; &lt;p&gt; left&lt;/p&gt; &lt;p&gt; left&lt;/p&gt; &lt;p&gt; left&lt;/p&gt; &lt;p&gt; left&lt;/p&gt; &lt;p&gt; left&lt;/p&gt; &lt;p&gt; left&lt;/p&gt; &lt;p&gt; left&lt;/p&gt; &lt;p&gt; left&lt;/p&gt; &lt;p&gt; left&lt;/p&gt; &lt;p&gt; left&lt;/p&gt; &lt;p&gt; left&lt;/p&gt; &lt;p&gt; left&lt;/p&gt; &lt;p&gt; left&lt;/p&gt; &lt;p&gt; left&lt;/p&gt; &lt;p&gt; left&lt;/p&gt; &lt;p&gt; left&lt;/p&gt; &lt;p&gt; left&lt;/p&gt; &lt;p&gt; left&lt;/p&gt; &lt;p&gt; left&lt;/p&gt; &lt;p&gt; left&lt;/p&gt; &lt;p&gt; left&lt;/p&gt; &lt;p&gt; left&lt;/p&gt; &lt;p&gt; left&lt;/p&gt; &lt;p&gt; left&lt;/p&gt; &lt;p&gt; left&lt;/p&gt; &lt;p&gt; left&lt;/p&gt; &lt;p&gt; Last&lt;/p&gt; &lt;/ul&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;div id="main_col"&gt; &lt;div id="main_content_wrap"&gt; &lt;div id="contentpane"&gt;&lt;b&gt;Content Pane&lt;/b&gt; &lt;p&gt;Content Pane&lt;/b&gt; -always visible- this is the main page -- everyone else stay thin so we can see this this is the main page -- everyone else stay thin so we can see this this is the main page -- everyone else stay thin so we can see this&lt;/p&gt; &lt;ul&gt; &lt;p&gt; First&lt;/p&gt; &lt;p&gt; left&lt;/p&gt; &lt;p&gt; left&lt;/p&gt; &lt;p&gt; left&lt;/p&gt; &lt;p&gt; left&lt;/p&gt; &lt;p&gt; left&lt;/p&gt; &lt;p&gt; left&lt;/p&gt; &lt;p&gt; left&lt;/p&gt; &lt;p&gt; left&lt;/p&gt; &lt;p&gt; left&lt;/p&gt; &lt;p&gt; left&lt;/p&gt; &lt;p&gt; left&lt;/p&gt; &lt;p&gt; left&lt;/p&gt; &lt;p&gt; left&lt;/p&gt; &lt;p&gt; left&lt;/p&gt; &lt;p&gt; left&lt;/p&gt; &lt;p&gt; left&lt;/p&gt; &lt;p&gt; left&lt;/p&gt; &lt;p&gt; left&lt;/p&gt; &lt;p&gt; left&lt;/p&gt; &lt;p&gt; left&lt;/p&gt; &lt;p&gt; left&lt;/p&gt; &lt;p&gt; left&lt;/p&gt; &lt;p&gt; left&lt;/p&gt; &lt;p&gt; left&lt;/p&gt; &lt;p&gt; left&lt;/p&gt; &lt;p&gt; left&lt;/p&gt; &lt;p&gt; left&lt;/p&gt; &lt;p&gt; left&lt;/p&gt; &lt;p&gt; left&lt;/p&gt; &lt;p&gt; left&lt;/p&gt; &lt;p&gt; left&lt;/p&gt; &lt;p&gt; left&lt;/p&gt; &lt;p&gt; left&lt;/p&gt; &lt;p&gt; left&lt;/p&gt; &lt;p&gt; left&lt;/p&gt; &lt;p&gt; left&lt;/p&gt; &lt;p&gt; left&lt;/p&gt; &lt;p&gt; left&lt;/p&gt; &lt;p&gt; Last&lt;/p&gt; &lt;/ul&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;div id="footer"&gt;&lt;b&gt;Footer&lt;/b&gt; -always visible, always at bottom of window-&lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>Here's the solution:</p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;meta http-equiv="content-type" content="text/html; charset=utf-8" /&gt; &lt;title&gt;Application Wireframe&lt;/title&gt; &lt;style type="text/css"&gt; body { margin: 0; height: 100%; } #header { text-align: left; background: #4f0f00; color: #fff; width: 100%; margin: 0 0 0 0; border: 0; overflow: hidden; position: fixed; } #accountbar { background-color: #000000; color: white; height: 40px; width: 100%; } #contextbar { position:fixed; top:40px; width: 100%; } #leftheader { background-color: #66CCFF; height: 40px; width:200px; float:left; } #contentheader { background-color: #996600; color: white; height: 40px; } #middle { position:absolute; top:80px; width: 100%; overflow-y: visible; bottom: 8px; /*height: 100%;*/ } #left_col { float: left; width: 200px; /*height: 100%;*/ } #left_col_wrap { /*width: 100%; height: 100%; position: fixed;*/ } #leftnav { background-color: #66FFFF; height: 100%; overflow: scroll; /*width: 200px;*/ } #main_col { /*margin-left: 200px;*/ /*height: 100%;*/ } #main_content_wrap { /*position:fixed; width:100%; height: 100%;*/ } #messagegap { background-color: white; } #contentpane { background-color: #FFAA00; height: 100%; overflow: scroll; } #contentfoot { background-color: #C80; height: 20px; position: fixed; width: 100%; bottom: 0; padding-bottom: 18px; } #footer { background-color: #CCCCCC; clear: left; width: 100%; position: fixed; bottom: 0; } &lt;/style&gt; &lt;/head&gt; &lt;body&gt; &lt;div id="header"&gt; &lt;div id="accountbar"&gt;&lt;b&gt;Account Bar&lt;/b&gt; -always visible-this is the main page -- everyone else stay thin so we can see this this is the main page -- everyone else stay thin so we can see this this is the main page -- everyone else stay thin so we can see this&lt;/div&gt; &lt;/div&gt; &lt;div id="contextbar"&gt; &lt;div id="leftheader"&gt;&lt;b&gt;Left Header&lt;/b&gt;&lt;/br&gt;-usually says "Contents"-&lt;/div&gt; &lt;div id="contentheader"&gt;&lt;b&gt;Content Header&lt;/b&gt; -always visible- this is the main page -- everyone else stay thin so we can see this this is the main page -- everyone else stay thin so we can see this this is the main page -- everyone else stay thin so we can see this&lt;/div&gt; &lt;/div&gt; &lt;div id="middle"&gt; &lt;div id="left_col"&gt; &lt;div id="left_col_wrap"&gt; &lt;div id="leftnav"&gt;&lt;b&gt;Left Navigation&lt;/b&gt; &lt;ul&gt; &lt;p&gt; First&lt;/p&gt; &lt;p&gt; left&lt;/p&gt; &lt;p&gt; left&lt;/p&gt; &lt;p&gt; left&lt;/p&gt; &lt;p&gt; left&lt;/p&gt; &lt;p&gt; left&lt;/p&gt; &lt;p&gt; left&lt;/p&gt; &lt;p&gt; left&lt;/p&gt; &lt;p&gt; left&lt;/p&gt; &lt;p&gt; left&lt;/p&gt; &lt;p&gt; left&lt;/p&gt; &lt;p&gt; left&lt;/p&gt; &lt;p&gt; left&lt;/p&gt; &lt;p&gt; left&lt;/p&gt; &lt;p&gt; left&lt;/p&gt; &lt;p&gt; left&lt;/p&gt; &lt;p&gt; left&lt;/p&gt; &lt;p&gt; left&lt;/p&gt; &lt;p&gt; left&lt;/p&gt; &lt;p&gt; left&lt;/p&gt; &lt;p&gt; left&lt;/p&gt; &lt;p&gt; left&lt;/p&gt; &lt;p&gt; left&lt;/p&gt; &lt;p&gt; left&lt;/p&gt; &lt;p&gt; left&lt;/p&gt; &lt;p&gt; left&lt;/p&gt; &lt;p&gt; left&lt;/p&gt; &lt;p&gt; left&lt;/p&gt; &lt;p&gt; left&lt;/p&gt; &lt;p&gt; left&lt;/p&gt; &lt;p&gt; left&lt;/p&gt; &lt;p&gt; left&lt;/p&gt; &lt;p&gt; left&lt;/p&gt; &lt;p&gt; left&lt;/p&gt; &lt;p&gt; left&lt;/p&gt; &lt;p&gt; left&lt;/p&gt; &lt;p&gt; left&lt;/p&gt; &lt;p&gt; left&lt;/p&gt; &lt;p&gt; left&lt;/p&gt; &lt;p&gt; Last&lt;/p&gt; &lt;/ul&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;div id="main_col"&gt; &lt;div id="main_content_wrap"&gt; &lt;div id="contentpane"&gt;&lt;b&gt;Content Pane&lt;/b&gt; &lt;p&gt;Content Pane&lt;/b&gt; -always visible- this is the main page -- everyone else stay thin so we can see this this is the main page -- everyone else stay thin so we can see this this is the main page -- everyone else stay thin so we can see this&lt;/p&gt; &lt;ul&gt; &lt;p&gt; First&lt;/p&gt; &lt;p&gt; left&lt;/p&gt; &lt;p&gt; left&lt;/p&gt; &lt;p&gt; left&lt;/p&gt; &lt;p&gt; left&lt;/p&gt; &lt;p&gt; left&lt;/p&gt; &lt;p&gt; left&lt;/p&gt; &lt;p&gt; left&lt;/p&gt; &lt;p&gt; left&lt;/p&gt; &lt;p&gt; left&lt;/p&gt; &lt;p&gt; left&lt;/p&gt; &lt;p&gt; left&lt;/p&gt; &lt;p&gt; left&lt;/p&gt; &lt;p&gt; left&lt;/p&gt; &lt;p&gt; left&lt;/p&gt; &lt;p&gt; left&lt;/p&gt; &lt;p&gt; left&lt;/p&gt; &lt;p&gt; left&lt;/p&gt; &lt;p&gt; left&lt;/p&gt; &lt;p&gt; left&lt;/p&gt; &lt;p&gt; left&lt;/p&gt; &lt;p&gt; left&lt;/p&gt; &lt;p&gt; left&lt;/p&gt; &lt;p&gt; left&lt;/p&gt; &lt;p&gt; left&lt;/p&gt; &lt;p&gt; left&lt;/p&gt; &lt;p&gt; left&lt;/p&gt; &lt;p&gt; left&lt;/p&gt; &lt;p&gt; left&lt;/p&gt; &lt;p&gt; left&lt;/p&gt; &lt;p&gt; left&lt;/p&gt; &lt;p&gt; left&lt;/p&gt; &lt;p&gt; left&lt;/p&gt; &lt;p&gt; left&lt;/p&gt; &lt;p&gt; left&lt;/p&gt; &lt;p&gt; left&lt;/p&gt; &lt;p&gt; left&lt;/p&gt; &lt;p&gt; left&lt;/p&gt; &lt;p&gt; left&lt;/p&gt; &lt;p&gt; Last&lt;/p&gt; &lt;/ul&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;div id="footer"&gt;&lt;b&gt;Footer&lt;/b&gt; -always visible, always at bottom of window-&lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload