Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Vertical Floats?

Status
Not open for further replies.

grid212

Technical User
Joined
Feb 24, 2005
Messages
1
Location
GB
Hi,

I'm creating a page using CSS/XHML and I wonder if someone can help. Basically I have a DIV with a disclaimer I always want to appear at the bottom of the div. The disclaimer should be inline so that content doesn't overwrite it, but I also want the disclaimer to appear at the bottom of the div which is a fixed height, but can also overflow with content. Something like:

<div id="maincontent">

Some dynamic content here (this may be a little or a lot).

<div id="disclaimer">This disclaimer should appear at the bottom of the div, but also have a minimum margin if 20px with the content above
</div>

</div>

Basically what I need is something equivalent of a 'vertical float' - does anyone have any ideas?

Thanks a lot.
 
Normal document flow or relatively positioned elements will do that. If your #maincontent is not floated or positioned absolutely it will automatically push the next element at the bottom of it. If you start your #disclamer right after your #maincontent it will follow right after it. If for some design purposes, it needs be inserted into #maincontent, position it absolutely at the bottom and give #maincontent padding-bottom a big enough value to avoid content crashing into disclaimer.
Code:
#maincontent {
  ...
  padding-bottom: 20px;
}

#disclaimer {
  ...
  position: absolute;
  bottom: 0;
  height: 20px;
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top