Jump to content

Extending a div to the bottom of the page


GeemanKan

Recommended Posts

In order for an element to take on 100% height of the window, you'll have to give html and body 100% heights as well. Also, to do the math your trying to do in css, it needs to be written out as:

height: calc(100%-140px);

calc() isn't supported in earlier versions of IE, but you could also do something like this:

http://daylidesign.com/tests/remainingHeight.html

 

html:

<div class="widthContainer">	<div class="topContent">		<p>Top Content</p>	</div>	<div class="remainingHeight_container">		<div class="bottomContent">			<p>Bottom Content</p>		</div>	</div></div>

css:

html, body {	height: 100%;	margin: 0;}.widthContainer {	width: 960px;	height: 100%;	margin: 0 auto;	position: relative;}.topContent {	background: #CCC;	width: 100%;	height: 140px;	position: absolute;	top: 0;}.remainingHeight_container {	background: #999;	height: 100%;	overflow: hidden;}.bottomContent {	margin-top: 150px;} 

You could also use JavaScript.

Edited by Day
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...