Reply
Always vAlign Bottom
Old 11-09-2007, 07:45 PM Always vAlign Bottom
Extreme Talker

Posts: 153
Basically, I'm trying to get a div *bottom* to stick to the bottom of the page always, regardless if div *content* has enough data to push it down. Simple right? But it also needs to be able to align below the page just below *content* if the page needs to scroll, so it can't be aligned "absolutely". So how's it done?

Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Untitled Document</title>
<style type="text/css" title="">
#sidebar {
    background-color: #00CC00;
    float: left;
    height: 100%;
    width: 250px;
}
#content {
    background-color: #FF66FF;
    float: left;
    height: 100%;
    width: 600px;
}
#bottom {
    background-color: #CCCCCC;
    clear: both;
    width: 500px;
    bottom: 0px;
}

</style>
</head>

<body>

<div id="sidebar">Sidebar</div>

<div id="content">
  <p>Main Content Area </p>
  <p>&nbsp;</p>
  <p>&nbsp;</p>
  <p>&nbsp;</p>
  <p>&nbsp;</p>
 
</div>

<div id="bottom">Bottom Nav Div - this page is layingout correctly. </div>

</body>
</html>
empiresolutions is offline
Reply With Quote
View Public Profile
 
When You Register, These Ads Go Away!
Old 11-10-2007, 06:27 AM Re: Always vAlign Bottom
chrishirst's Avatar
Super Moderator

Posts: 13,469
Location: Blackpool. UK
It can't be done using CSS alone.
You would need to use scripting to check if the content height is less than the browser viewport height and set the div style or classname to suit.

BTW. Changing the class name is quicker than setting style properties.
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
Indifference will be the downfall of mankind, but who cares?
Code Samples | People Counting System
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 11-10-2007, 11:30 AM Re: Always vAlign Bottom
LadynRed's Avatar
Super Moderator

Posts: 6,534
Location: Tennessee
this might work http://www.themaninblue.com/writing/...ve/2005/08/29/
__________________
Web Goddess & Web Standards Evangelist :) - Tables Be Gone !!
"Using or working with IE is like having to wear a 1970's polyester suit with pantyhose and a girdle, to work everyday"
Carolina Corvette Club
LadynRed is offline
Reply With Quote
View Public Profile
 
Old 11-12-2007, 05:23 AM Re: Always vAlign Bottom
chrishirst's Avatar
Super Moderator

Posts: 13,469
Location: Blackpool. UK
Decided this was a good candidate for one of my occasional DHTML scripting "articles"

"Floating" or "Sticky" Footer?

Write up not quite complete BTW
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
Indifference will be the downfall of mankind, but who cares?
Code Samples | People Counting System
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 11-14-2007, 03:05 AM Re: Always vAlign Bottom
Extreme Talker

Posts: 153
Thanks for all the help. These links seem to provide similar ways to do what I'm looking for.

http://scott.sauyet.com/CSS/Demo/FooterDemo1.html

http://ryanfait.com/sticky-footer/

http://www.themaninblue.com/writing/...ve/2005/08/29/
empiresolutions is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Always vAlign Bottom
 

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.16770 seconds with 12 queries