CSS Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsWeb DesignCSS Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old August 6th, 2003, 06:58 AM
akpcep akpcep is offline
Diagonal Man
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2001
Location: On your monitor
Posts: 210 akpcep User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 h 33 m 47 sec
Reputation Power: 12
CSS Layout - filling a container div with divs

Hi all,

I'm excruciatingly close to completing a three column CSS layout, in fact I have. But I have a problem..

I have one container div, containing 3 other divs, all floated left so they stack up next to each other, this works great (the container div is a fixed width). However, I want to have a solid background colour in the container div but this won't work. The container div is effectively 'empty' as it only contains the three other divs. The 3 divs flow out of this container div, overflow:visible won't have any effect because it only relates to actual content within a div, not other divs.

If I put line breaks or other inline content in the container div, it stretches down accordingly, but as I want the container div to automatically "envelope" the three inside divs automatically, I'm at a loss.

Can anyone help here? relative and absolute positioning the divs within the container doesn't work either.

Reply With Quote
  #2  
Old August 6th, 2003, 08:12 AM
toofan toofan is offline
:: cerebralshock ::
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2002
Location: Everywhere & nowhere.
Posts: 133 toofan User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 44 m 49 sec
Reputation Power: 11
<div id="container" style="background-color: bgcolor;">
<div id="1">blah1</div>
<div id="2">blah2</div>
<div id="3">blah3</div>
</div>

Reply With Quote
  #3  
Old August 6th, 2003, 09:50 AM
akpcep akpcep is offline
Diagonal Man
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2001
Location: On your monitor
Posts: 210 akpcep User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 h 33 m 47 sec
Reputation Power: 12
That won't work, if you try it. The divs 'drop out' the bottom of the container.

The solution, it seems, is height: auto, followed by a box model hack that specifies min-height: <value> for CSS2 compliant browsers.

.centercontent {
height: 520px;

}

html>body .centercontent {

height: auto;
min-height: 520px;
}

Reply With Quote
  #4  
Old August 6th, 2003, 02:19 PM
jharnois's Avatar
jharnois jharnois is offline
mod_dev_shed
Dev Shed God 20th Plane (14500 - 14999 posts)
 
Join Date: Sep 2002
Location: Atlanta, GA
Posts: 14,817 jharnois User rank is General 2nd Grade (Above 100000 Reputation Level)jharnois User rank is General 2nd Grade (Above 100000 Reputation Level)jharnois User rank is General 2nd Grade (Above 100000 Reputation Level)jharnois User rank is General 2nd Grade (Above 100000 Reputation Level)jharnois User rank is General 2nd Grade (Above 100000 Reputation Level)jharnois User rank is General 2nd Grade (Above 100000 Reputation Level)jharnois User rank is General 2nd Grade (Above 100000 Reputation Level)jharnois User rank is General 2nd Grade (Above 100000 Reputation Level)jharnois User rank is General 2nd Grade (Above 100000 Reputation Level)jharnois User rank is General 2nd Grade (Above 100000 Reputation Level)jharnois User rank is General 2nd Grade (Above 100000 Reputation Level)jharnois User rank is General 2nd Grade (Above 100000 Reputation Level)jharnois User rank is General 2nd Grade (Above 100000 Reputation Level)jharnois User rank is General 2nd Grade (Above 100000 Reputation Level)jharnois User rank is General 2nd Grade (Above 100000 Reputation Level)jharnois User rank is General 2nd Grade (Above 100000 Reputation Level) 
Time spent in forums: 1 Month 1 Week 4 Days 7 h 14 m 56 sec
Reputation Power: 1098
If you float all the <div>s you'll get the desired effect.
Code:
<div style="float:left:background-color:red">
  <div style="clear:left;float:left;">X</div>
  <div style="clear:left;float:left;">Y</div>
  <div style="clear:left;float:left;">Z</div>
</div>
__________________
# Jeremy

Explain your problem instead of asking how to do what you decided was the solution.

Reply With Quote
  #5  
Old August 6th, 2003, 02:32 PM
akpcep akpcep is offline
Diagonal Man
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2001
Location: On your monitor
Posts: 210 akpcep User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 h 33 m 47 sec
Reputation Power: 12
I just tried that, and the divs sit on top of one another, not next to each other...

Reply With Quote
  #6  
Old August 6th, 2003, 02:34 PM
jharnois's Avatar
jharnois jharnois is offline
mod_dev_shed
Dev Shed God 20th Plane (14500 - 14999 posts)
 
Join Date: Sep 2002
Location: Atlanta, GA
Posts: 14,817 jharnois User rank is General 2nd Grade (Above 100000 Reputation Level)jharnois User rank is General 2nd Grade (Above 100000 Reputation Level)jharnois User rank is General 2nd Grade (Above 100000 Reputation Level)jharnois User rank is General 2nd Grade (Above 100000 Reputation Level)jharnois User rank is General 2nd Grade (Above 100000 Reputation Level)jharnois User rank is General 2nd Grade (Above 100000 Reputation Level)jharnois User rank is General 2nd Grade (Above 100000 Reputation Level)jharnois User rank is General 2nd Grade (Above 100000 Reputation Level)jharnois User rank is General 2nd Grade (Above 100000 Reputation Level)jharnois User rank is General 2nd Grade (Above 100000 Reputation Level)jharnois User rank is General 2nd Grade (Above 100000 Reputation Level)jharnois User rank is General 2nd Grade (Above 100000 Reputation Level)jharnois User rank is General 2nd Grade (Above 100000 Reputation Level)jharnois User rank is General 2nd Grade (Above 100000 Reputation Level)jharnois User rank is General 2nd Grade (Above 100000 Reputation Level)jharnois User rank is General 2nd Grade (Above 100000 Reputation Level) 
Time spent in forums: 1 Month 1 Week 4 Days 7 h 14 m 56 sec
Reputation Power: 1098
Sorry, I didn't read your entire post so I missed that part. Just don't clear the last two. The key is that the container must also float.
Code:
<div style="float:left:background-color:red">
  <div style="clear:left;float:left;">X</div>
  <div style="float:left;">Y</div>
  <div style="float:left;">Z</div>
</div>

Reply With Quote
  #7  
Old August 6th, 2003, 02:58 PM
akpcep akpcep is offline
Diagonal Man
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2001
Location: On your monitor
Posts: 210 akpcep User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 h 33 m 47 sec
Reputation Power: 12
Ah! Excellent!

Many thanks!

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignCSS Help > CSS Layout - filling a container div with divs

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap