Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > HTML > How to align a div on the bottom of another one (using css)?

Reply
Thread Tools

How to align a div on the bottom of another one (using css)?

 
 
Rafael Cotta
Guest
Posts: n/a
 
      04-29-2005
Hi all,

I am trying to desgign a website without tables (tableless) but I
cannot figure out how to put a "footer" <div> inside another one with
height 100%.

What I need is the footer positined on the bottom of the page when
there's not much content and when there's a lot of contents.

I'll try to make myself a little bit more clear showing the code:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> New Document </TITLE>

<style type='text/css'>
body {height: 100%; margin: 0px; font-family: Verdana,
sans-serif; background: #cccccc;}
div {text-align: left; }
.title {background: #61b6f5; font-size: 24px; padding: 4px; }
.maindiv{height:100%; width: 750px; border: 1px #216695 solid;
border-top: 4px #216695 solid; background: white;}
.content{clear: both;}
.footer {background: green; height: 25px;}
</style>

</HEAD>

<BODY>
<center style='height: 100%'>
<div class="maindiv">
<div class='title'>Page Title</div>
<div class='content'>
<p>Some content... more content...</p>
</div>
<div class='footer'>&copy; me</div>
</div>
</center>
</BODY>
</HTML>

The green bar must be on the bottom, but I don't know how to do this.
Is there a solution (without JavaScript)?

Rafael
 
Reply With Quote
 
 
 
 
Lawrence
Guest
Posts: n/a
 
      04-29-2005


"Rafael Cotta" <> wrote in message
news: om...
> Hi all,
>
> The green bar must be on the bottom, but I don't know how to do this.
> Is there a solution (without JavaScript)?
>
> Rafael


Does this work for you?

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<style type='text/css'>
body {height: 100%; margin: 0px; font-family: Verdana,
sans-serif; background: #cccccc;}
div {text-align: left; }
.title {background: #61b6f5; font-size: 24px; padding: 4px; }
.maindiv{height:100%; width: 750px; border: 1px #216695 solid;
border-top: 4px #216695 solid; background: white;}
.content{clear: both;}
.footer {background: green; height: 25px; width:750px;}
</style>
</HEAD>
<BODY>
<center style='height: 100%'>
<div class="maindiv">
<div class='title'>Page Title</div>
<div class='content'>
<p>Some content... more content...</p>
</div>
</div>
<div class='footer'>&copy; me</div>
</center>
</BODY>
</HTML>

Pull the height:100% out of .maindiv and it's resizable.
--
Lawrence
http://www.netmidwest.com/
Host With The Best - NetMidWest!


 
Reply With Quote
 
 
 
Reply

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

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
css "div" bottom of window or bottom of content. Dan HTML 1 04-04-2008 09:40 AM
<div align=center> also affects align of dynamic dropdown item text Steve Richter ASP .Net 1 06-24-2007 07:11 PM
aligning a nested div to the bottom of the parent div Chris HTML 2 09-28-2006 08:48 PM
div bottom align inside td tgh003@gmail.com HTML 0 02-06-2006 12:21 AM
Using CSS to align a div to the very bottom of the page (inc. other absolute divs) Andrew HTML 1 01-12-2005 05:51 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57