![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I am so puzzled by this. I've got following html and css of 2 column layout. css: div#parent{width:100%;border:solid 1px black;background-color:red;} div#parent div#left, div#parent div#right{width:50%;} div#left{float:left} div#left{float:right} html: div id="parent" div id="left">Left column</div div id="right">Right column</div /div Left and right column line up correctly, they go out of parent div (=#parent) therefore no red background is showing. And I got rid of float values from both div#left and div#right which makes both of them stacked on top of each other. And it stays in div#parent hence red background appears. I've also tried messing around with position attribute, but it didn't change anything. Can anyone help me with this? |
#3
| |||
| |||
|
|
On 2008-11-20, Jimmy <axk... (AT) gmail (DOT) com> wrote: I am so puzzled by this. I've got following html and css of 2 column layout. css: div#parent{width:100%;border:solid 1px black;background-color:red;} div#parent div#left, div#parent div#right{width:50%;} div#left{float:left} div#left{float:right} html: div id="parent" * *<div id="left">Left column</div * *<div id="right">Right column</div /div Left and right column line up correctly, they go out of parent div (=#parent) therefore no red background is showing. And I got rid of float values from both div#left and div#right which makes both of them stacked on top of each other. And it stays in div#parent hence red background appears. I've also tried messing around with position attribute, but it didn't change anything. Can anyone help me with this? Add overflow: hidden to parent. Seehttp://netweaver.com.au/floatHouse |
#4
| |||
| |||
|
|
On Nov 20, 12:44*pm, Ben C <spams... (AT) spam (DOT) eggs> wrote: On 2008-11-20, Jimmy <axk... (AT) gmail (DOT) com> wrote: I am so puzzled by this. I've got following html and css of 2 column layout. css: div#parent{width:100%;border:solid 1px black;background-color:red;} div#parent div#left, div#parent div#right{width:50%;} div#left{float:left} div#left{float:right} html: div id="parent" * *<div id="left">Left column</div * *<div id="right">Right column</div /div Left and right column line up correctly, they go out of parent div (=#parent) therefore no red background is showing. And I got rid of float values from both div#left and div#right which makes both of them stacked on top of each other. And it stays in div#parent hence red background appears. I've also tried messing around with position attribute, but it didn't change anything. Can anyone help me with this? Add overflow: hidden to parent. Seehttp://netweaver.com.au/floatHouse Oh... My.. God... You have no idea how much I am relieved right now. Thank you so much! |
#5
| |||
| |||
|
|
I am so puzzled by this. I've got following html and css of 2 column layout. css: div#parent{width:100%;border:solid 1px black;background-color:red;} div#parent div#left, div#parent div#right{width:50%;} div#left{float:left} div#left{float:right} html: div id="parent" div id="left">Left column</div div id="right">Right column</div /div Left and right column line up correctly, they go out of parent div (=#parent) therefore no red background is showing. And I got rid of float values from both div#left and div#right which makes both of them stacked on top of each other. And it stays in div#parent hence red background appears. I've also tried messing around with position attribute, but it didn't change anything. Can anyone help me with this? |
#6
| |||
| |||
|
|
On Nov 20, 12:54*pm, Jimmy <axk... (AT) gmail (DOT) com> wrote: On Nov 20, 12:44*pm, Ben C <spams... (AT) spam (DOT) eggs> wrote: .... Can anyone help me with this? Add overflow: hidden to parent. See http://netweaver.com.au/floatHouse Oh... My.. God... You have no idea how much I am relieved right now. Thank you so much! OK... now. It turns out that I am not quite liberated just yet. It works on Firefox but no in IE. Is there solution for IE? |
#7
| ||||||
| ||||||
|
|
On Thu, 20 Nov 2008 09:00:07 -0800 (PST), Jimmy <axkixx (AT) gmail (DOT) com wrote: I am so puzzled by this. I've got following html and css of 2 column layout. css: div#parent{width:100%;border:solid 1px black;background-color:red;} div#parent div#left, div#parent div#right{width:50%;} div#left{float:left} div#left{float:right} html: div id="parent" div id="left">Left column</div div id="right">Right column</div /div Left and right column line up correctly, they go out of parent div (=#parent) therefore no red background is showing. And I got rid of float values from both div#left and div#right which makes both of them stacked on top of each other. And it stays in div#parent hence red background appears. I've also tried messing around with position attribute, but it didn't change anything. Can anyone help me with this? |
|
One thing many |
|
people do not realize is, a division has a border. Whether it is visible or not. |
|
So if you have two divisions set to 50% plus the border, don't we wind up with more than 100%? |
|
Which causes one division to break. |
|
Therefore, we simply drop the % down to say like 48% and you should see them as intended. |
#8
| |||
| |||
|
|
On Thu, 20 Nov 2008 09:00:07 -0800 (PST), Jimmy <axkixx (AT) gmail (DOT) com wrote: I am so puzzled by this. I've got following html and css of 2 column layout. css: div#parent{width:100%;border:solid 1px black;background-color:red;} div#parent div#left, div#parent div#right{width:50%;} div#left{float:left} div#left{float:right} html: div id="parent" div id="left">Left column</div div id="right">Right column</div /div Left and right column line up correctly, they go out of parent div (=#parent) therefore no red background is showing. And I got rid of float values from both div#left and div#right which makes both of them stacked on top of each other. And it stays in div#parent hence red background appears. I've also tried messing around with position attribute, but it didn't change anything. Can anyone help me with this? One thing many people do not realize is, a division has a border. Whether it is visible or not. So if you have two divisions set to 50% plus the border, don't we wind up with more than 100%? Which causes one division to break. Therefore, we simply drop the % down to say like 48% and you should see them as intended. |
#9
| |||
| |||
|
|
"richard" <mem... (AT) newsguy (DOT) com> wrote in message news:7bhbi4pokuh5tav0uhe233a5a03b1a79gm (AT) 4ax (DOT) com... On Thu, 20 Nov 2008 09:00:07 -0800 (PST), Jimmy <axk... (AT) gmail (DOT) com wrote: I am so puzzled by this. I've got following html and css of 2 column layout. css: div#parent{width:100%;border:solid 1px black;background-color:red;} div#parent div#left, div#parent div#right{width:50%;} div#left{float:left} div#left{float:right} html: div id="parent" * <div id="left">Left column</div * <div id="right">Right column</div /div Left and right column line up correctly, they go out of parent div (=#parent) therefore no red background is showing. And I got rid of float values from both div#left and div#right which makes both of them stacked on top of each other. And it stays in div#parent hence red background appears. I've also tried messing around with position attribute, but it didn't change anything. Can anyone help me with this? One thing many I wouldn't say many. I'd say one, or possibly two. people do not realize is, a division has a border. Whether it is visible or not. While technically true your inference is wrong. The border can be 0 width, in which case and from the recommendation: "the border edge is the same as the padding edge". The border is not just invisible, it is not there at all as far as the layout is concerned. So if you have two divisions set to 50% plus the border, don't we wind up with more than 100%? No we don't. Not when the borders are 0 width. Well, not for the reasons you infer. We can add up to more than 100% if the browser has to round to the nearest pixel. Say the viewport is 801 pixels wide and the two divs are specifiedas 50%. The browser *may* choose to interpret 50% of 801 as being 401. So we end up with 802 pixels, wider than the viewport. This is, however, nothing at all to do with the 0 width borders of those divs. Which causes one division to break. What does "break" mean? Well, the OP had specified 100% on one div and 50% on two others from |
|
Therefore, we simply drop the % down to say like 48% and you should see them as intended. But what, if anything, does all of this have to do with the OPs question which relates to content escaping a div?- Hide quoted text - He had specified a layout that was more then 100% width, so dropping |
![]() |
| Thread Tools | |
| Display Modes | |
| |