![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I have a problem with float in firefox/mozilla, the 'ads'-div doesn't resize on the height with the 'ads_left' and 'ads_right'. In IE there is no problem but in FF there is. The 'ads'-div do not resize at all. div id="ads" div id="ads_left">content</div div id="ads_right">content</div /div #ads {width: 510px; height: auto;} #ads_left { float: left; width: 240px;} #ads_right { float: right; width: 240px;} |
#3
| |||
| |||
|
|
Gnolen <hendrikgnolen (AT) hotmail (DOT) com> wrote: I have a problem with float in firefox/mozilla, the 'ads'-div doesn't resize on the height with the 'ads_left' and 'ads_right'. In IE there is no problem but in FF there is. The 'ads'-div do not resize at all. div id="ads" div id="ads_left">content</div div id="ads_right">content</div /div #ads {width: 510px; height: auto;} #ads_left { float: left; width: 240px;} #ads_right { float: right; width: 240px;} Floated elements are taken out of the doument flow and hence do not contribute to the height of their parent. Hence 'ads' has no content and thus no height. You need an element after 'ads_right' and before the end of 'ads' with clear: both; set. Steve |
#4
| |||
| |||
|
|
On Wed, 09 Mar 2005 16:53:52 GMT Gnolen wrote: Hi, I have a problem with float in firefox/mozilla, the 'ads'-div doesn't resize on the height with the 'ads_left' and 'ads_right'. In IE there is no problem but in FF there is. The 'ads'-div do not resize at all. How come? HTML div id="ads" div id="ads_left">content</div div id="ads_right">content</div /div CSS #ads {width: 510px; height: auto;} #ads_left { float: left; width: 240px;} #ads_right { float: right; width: 240px;} Thanks for any help I could get! / Gnolen You should set the ads division to a known height since that is the parent and you know it will have content. As long as it is not in another container, it should expand as needed. I'd start off with the height of what ever image it is you're going to use initially. #ads {width:800px; height:100px;} |
#5
| |||
| |||
|
|
On Wed, 09 Mar 2005 16:53:52 GMT Gnolen wrote: I have a problem with float in firefox/mozilla, the 'ads'-div doesn't resize on the height with the 'ads_left' and 'ads_right'. In IE there is no problem but in FF there is. The 'ads'-div do not resize at all. div id="ads" div id="ads_left">content</div div id="ads_right">content</div /div #ads {width: 510px; height: auto;} #ads_left { float: left; width: 240px;} #ads_right { float: right; width: 240px;} You should set the ads division to a known height since that is the parent and you know it will have content. |
|
As long as it is not in another container, it should expand as needed. |
|
I'd start off with the height of what ever image it is you're going to use initially. |
#6
| |||
| |||
|
|
"Richard" <Anonymous (AT) 127 (DOT) 001> wrote: On Wed, 09 Mar 2005 16:53:52 GMT Gnolen wrote: I have a problem with float in firefox/mozilla, the 'ads'-div doesn't resize on the height with the 'ads_left' and 'ads_right'. In IE there is no problem but in FF there is. The 'ads'-div do not resize at all. div id="ads" div id="ads_left">content</div div id="ads_right">content</div /div #ads {width: 510px; height: auto;} #ads_left { float: left; width: 240px;} #ads_right { float: right; width: 240px;} You should set the ads division to a known height since that is the parent and you know it will have content. Technically it doesn't have any content in CSS terms for the reason given in my post. And unless all the contents of the two floated divs are images you have no way of knowing how much height will be needed, As long as it is not in another container, it should expand as needed. No it won't. See my post for the reason why. I'd start off with the height of what ever image it is you're going to use initially. Are you assuming that just because the divs are labelled as being 'ads' that they will contain nothing but images? Steve |
#7
| |||
| |||
|
|
Gnolen <hendrikgnolen (AT) hotmail (DOT) com> wrote: div id="ads" div id="ads_left">content</div div id="ads_right">content</div /div #ads {width: 510px; height: auto;} #ads_left { float: left; width: 240px;} #ads_right { float: right; width: 240px;} Floated elements are taken out of the doument flow and hence do not contribute to the height of their parent. Hence 'ads' has no content and thus no height. You need an element after 'ads_right' and before the end of 'ads' with clear: both; set. |
![]() |
| Thread Tools | |
| Display Modes | |
| |