Jump to content

Extending a div to the bottom of the page

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:




<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>


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

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...