The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.
|
 |
|
Dev Shed Forums
> Web Design
> CSS Help
|
Trying to put two boxes inside a thrid box with CSS. But outside will not autosize.
Discuss Trying to put two boxes inside a thrid box with CSS. But outside will not autosize. in the CSS Help forum on Dev Shed. Trying to put two boxes inside a thrid box with CSS. But outside will not autosize. Cascading Style Sheets (CSS) forum discussing all levels of CSS, including CSS1, CSS2 and CSS Positioning. CSS provides a robust way of applying standardized design concepts to your web pages.
|
|
 |
|
|
|
|

Dev Shed Forums Sponsor:
|
|
|

June 11th, 2003, 09:07 PM
|
 |
PHP user-in-training
|
|
Join Date: Oct 2001
Location: Sacramento Calif. USA
Posts: 677
Time spent in forums: 1 Day 10 h 7 m
Reputation Power: 0
|
|
|
Trying to put two boxes inside a thrid box with CSS. But outside will not autosize.
Here is the code of what I am attempting:
PHP Code:
#outside_box {
position: relative;
width: 100%;
font: 18px Verdana, sans-serif;
color: #777777;
padding: 0px;
border: 1px solid #999999;
margin-bottom: 5px;
background: transparent;
}
#inside_box_left {
position: absolute;
width: 70%;
left:0;
padding: 0px;
border: 0px solid #999999;
margin: 0px;
background: lightgrey;
}
#inside_box_right {
position: absolute;
width: 30%;
right:0;
padding: 0px;
border: 0px solid #999999;
margin: 0px;
background: lightgrey;
}
<div id="outside_box">
<div id="inside_box_left">
text left box
</div>
<div id="inside_box_right">
text right box
</div>
</div>
The two inside boxes form correctly, but the outside box does not correctly adjust to contain the inside boxes.
I know I have read something about what I am missing here, so am hoping someone can give me a pointer.
Thanks for any help. 
|

June 11th, 2003, 09:39 PM
|
 |
Contributing User
|
|
Join Date: Aug 2002
Location: Queensland, Australia
|
|
|

June 11th, 2003, 09:48 PM
|
 |
PHP user-in-training
|
|
Join Date: Oct 2001
Location: Sacramento Calif. USA
Posts: 677
Time spent in forums: 1 Day 10 h 7 m
Reputation Power: 0
|
|
|
Yes it may, thanks for the reference.
|

June 12th, 2003, 01:01 PM
|
|
Senior Member
|
|
Join Date: May 2003
Posts: 151
Time spent in forums: 3 m 36 sec
Reputation Power: 0
|
|
|
seems fine to me. the outside box is 100%, with the inners adding up to 100% too. what are you trying to do?
|

June 12th, 2003, 04:35 PM
|
 |
PHP user-in-training
|
|
Join Date: Oct 2001
Location: Sacramento Calif. USA
Posts: 677
Time spent in forums: 1 Day 10 h 7 m
Reputation Power: 0
|
|
Well the problem with the CSS examples given, is that they will not fill up their respective side of the outside box.
So for example, if I want to have two boxes next to each other, as you might have two table cells. And I want the left box to be some form entry description, and the right box to be the form text entry cell - If the text is long the box on the left will expand correctly(3 lines), but the background of the box on the right(1 line), will only extend to the vertical height of the 1 line.
Now if you used two table cells and not css, you could have each cells color defined, and not worry about the left cell being 3 times as high as the cell on the right, and thus affected the right cells background color.
Hope that makes sense.
|

June 12th, 2003, 04:44 PM
|
|
Senior Member
|
|
Join Date: May 2003
Posts: 151
Time spent in forums: 3 m 36 sec
Reputation Power: 0
|
|
|
Oh, ok. then set the height of the inner boxes to 100%
|

June 12th, 2003, 08:07 PM
|
 |
PHP user-in-training
|
|
Join Date: Oct 2001
Location: Sacramento Calif. USA
Posts: 677
Time spent in forums: 1 Day 10 h 7 m
Reputation Power: 0
|
|
Yes, tried that and still no luck, the rightside box still wants to only cover 1 line height for some reason.
here is what the CSS looks like:
PHP Code:
#inside_box_left {
float: left;
padding-left: 10px;
width: 70%;
height: 100%;
left:0;
padding: 0px;
border: 0px solid #999999;
margin-left: 0px;
background: lightgrey;
}
#inside_box_right {
float: right;
padding-right: 10px;
width: 30%;
height: 100%;
right:0;
padding: 0px;
border: 0px solid #999999;
margin-right: 0px;
background: #999999;
}
|

June 12th, 2003, 09:00 PM
|
|
Senior Member
|
|
Join Date: May 2003
Posts: 151
Time spent in forums: 3 m 36 sec
Reputation Power: 0
|
|
|
oh. you must set the outer box to have a height. then it will work.
|

June 12th, 2003, 10:48 PM
|
 |
PHP user-in-training
|
|
Join Date: Oct 2001
Location: Sacramento Calif. USA
Posts: 677
Time spent in forums: 1 Day 10 h 7 m
Reputation Power: 0
|
|
Ahhh, that got it. Thanks

|

June 13th, 2003, 12:04 AM
|
 |
PHP user-in-training
|
|
Join Date: Oct 2001
Location: Sacramento Calif. USA
Posts: 677
Time spent in forums: 1 Day 10 h 7 m
Reputation Power: 0
|
|
|
hah.
Ok one more question.
I have a checkbox in the right-side box, is there a way to vertically align it?
I tried
vertical-align:middle;
and
vertical-align:text-middle;
but had no success.
Since it is a form object, not sure how to deal with it.
|
Developer Shed Advertisers and Affiliates
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Rate This Thread |
Linear Mode
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|