html - Content div height exceeding page height -


i have issue height of "content body" div (below) exceeding bottom of page (and behind page footer). want div scroll when there long content, now, doesn't scroll bottom of div beyond page. i'm not sure causing issue? here example: http://jsfiddle.net/gg6qy/

css:

html, body {     height:100%;     width: 100%;     overflow: hidden;     margin: 0; } header {     position: fixed;     width: 100%;     background: #006f3b;     color: #fff;     top: 0;     height: 60px;     padding: 10px; } #content {     position: relative;     height: 100%;     width: 100%;     padding: 60px 0 20px 0;     /* header height , footer height */     margin: 0 auto;     /* center content */ } #sidebar {     position: absolute;     background: #191919;     color: #fff;     left: 0;     top: 60px;     bottom: 0;     width: 220px;     padding: 10px;     -moz-box-sizing: border-box;     -webkit-box-sizing: border-box;     -o-box-sizing: border-box;     -ms-box-sizing: border-box;     box-sizing: border-box; } #contentheader {     position: relative;     left: 220px;     z-index: 100;     padding: 10px;     background: #fff;     border-bottom: 1px solid #191919;     -webkit-box-shadow: 3px 3px 3px #888888;     -ms-box-shadow: 3px 3px 3px #888888;     box-shadow: 3px 3px 3px #888888; } #contentbody {     position: relative;     background: #fff;     height: 100%;     margin-left: 220px;     padding: 0 10px;     overflow-y: scroll; } footer {     position: fixed;     width: 100%;     background: #999;     color: #000;     bottom: 0;     height: 20px;     text-align: center; } 

html:

<body>     <header>the header</header>     <div id="content">         <div id="sidebar">the sidebar</div>         <div id="contentheader">the content header</div>         <div id="contentbody">             <p>the content body</p>         </div>     </div>     <footer>the footer</footer> 

thanks!

body , #content, goes beyond window size height:100% means height of content area of body if add top , bottom padding, goes beyond window. use box-sizing:border-box fix this.

contentbody expand maximum available height, make absolute , set top , bottom.

contentbody should work ideally height 100%. have not checked that.

updated fiddle:

http://jsfiddle.net/gayf4/1/


Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -