Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

CSS Forum


You are currently viewing our CSS Forum as a guest. Please register to participate.
Login



Reply
how can i get a div to stay at the bottom of a parent div that's within another div?
Old 12-31-2010, 02:36 AM how can i get a div to stay at the bottom of a parent div that's within another div?
Junior Talker

Posts: 4
Name: howard
Trades: 0
I promise, I searched for my issue, couldn't find one that worked.



say we have a page set up like the image that's attached, i would like the #box div to be at the bottom of the #wrap div like in the image, where the #wrap div is variable height on each page. a simple quick example of the css:

Code:
    #wrap {
      width: 960px;
      height: 500px;
      margin: auto;
    }
    .stuff1 {
      width: inherit;
      height: 100px;
      margin: 0px;
    }
    .stuff2 {
      width: 470px;
      height: 150px;
      float: left;
      margin: 0px;
    }
    #box {
      width: inherit;
      height: 60px;
    }
imagine a gap of space between the .stuff2 divs and the #box divs, how could i make the #box div stay at the bottom of the #wrap div at all times? Your help is appreciated in advance!
Attached Images
File Type: jpg div_prob.jpg (29.6 KB, 6 views)
learnerhoward is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 12-31-2010, 04:11 AM Re: how can i get a div to stay at the bottom of a parent div that's within another d
Novice Talker

Posts: 11
Name: bobs
Trades: 0
Use margin property. For example.

margin: 10px; 0px; 10px; 0px; etc..
if you want space within div then use padding.
__________________

Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
bobs is offline
Reply With Quote
View Public Profile
 
Old 12-31-2010, 11:15 AM Re: how can i get a div to stay at the bottom of a parent div that's within another d
Gilligan's Avatar
Website Designer

Posts: 1,670
Name: Stefan
Location: London, UK
Trades: 0
Assign the parent div a relative position and the child div an absolute position with bottom:0

So in this case:

Code:
#wrap { 
   width: 960px
   height: 500px;
   margin: auto;
   position: relative;
}
.stuff1 {
   width: inherit;
   height: 100px;
   margin: 0px;
}

.stuff2 {
   width: 470px;
   height: 150px;
   float: left;
   margin: 0px;
    
#box {
   width: inherit;
   height: 60px;
   position: absolute;
   bottom: 0;
}
__________________

Please login or register to view this content. Registration is FREE
Gilligan is offline
Reply With Quote
View Public Profile
 
Old 12-31-2010, 02:02 PM Re: how can i get a div to stay at the bottom of a parent div that's within another d
Junior Talker

Posts: 4
Name: howard
Trades: 0
so both of the methods you two have shown will work when the #wrap div is long enough to require the page to scroll?
learnerhoward is offline
Reply With Quote
View Public Profile
 
Old 12-31-2010, 02:07 PM Re: how can i get a div to stay at the bottom of a parent div that's within another d
Junior Talker

Posts: 4
Name: howard
Trades: 0
also, thanks very much for the replies
learnerhoward is offline
Reply With Quote
View Public Profile
 
Old 12-31-2010, 02:28 PM Re: how can i get a div to stay at the bottom of a parent div that's within another d
Junior Talker

Posts: 4
Name: howard
Trades: 0
Any Tips on how to make it internet explorer friendly?
learnerhoward is offline
Reply With Quote
View Public Profile
 
Old 01-07-2011, 12:32 PM Re: how can i get a div to stay at the bottom of a parent div that's within another d
Skilled Talker

Posts: 59
Name: Lisa Forgan
Location: Colorado
Trades: 0
As long as you make the parent div position absolute and the child div position relative with bottom:0... it "should" work in IE too.
Puddlemut is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to how can i get a div to stay at the bottom of a parent div that's within another div?
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 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.77625 seconds with 13 queries