473,406 Members | 2,633 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

float with set width forces outer container to width of inner container

I ran into a problem a think. Either that or I overlooked something.
I seem to run into this problem quite often. I fail to pinpoint the
problem and it appears as a bug with mozilla browsers. Anyone willing
to offer a hint or suggestion as to why the outer container retains
the width of the inner container, instead of auto-clearing both sides
and instead of growing to the size of the container holding everything?

<div id="container"><!-- container -->

....

<div><!-- outer_container -->
<!-- http://google2.fda.gov/search?q=canola -->
<div style="width:500px;float:left;margin:1.25em auto;border:1px #AA0000 solid;padding:1.25em;clear:both;">
<form action="http://google2.fda.gov/search" method="get">
<p>Please enter what you want to find at the F.D.A. Type <i>canola</ior <i>rapeseed</iinto the text box below.</p>
<p class="pc"><b>Enter Words</b>: <input type="text" name="q" style="width:300px;" /><br />
<input type="submit" value="Submit" /></p></form>
</div><!-- outer_container --></div>

....

<!-- container --></div>

I tried the following styles for the outer_container:

<div style="width:100%;"><!-- outer_container -->
<div style="width:auto;"><!-- outer_container -->

I must be missing out on something...

microcosmotalk dot com/live/health/canola/#canola_more_information

Thanks for any help that comes my way.

--
Jim Carlock
You Have More Than Five Senses
http://www.associatedcontent.com/art...ve_senses.html

Sep 20 '08 #1
2 3879
Jim Carlock wrote:
I ran into a problem a think. Either that or I overlooked something.
I seem to run into this problem quite often. I fail to pinpoint the
problem and it appears as a bug with mozilla browsers.
No, Mozilla is getting it right, but I assume you think IE is correct
here. Floats are *not* contained by their static parents. Now what we
don't have here is a URL! (Seems like a broken record, but there maybe
factors which are not included in your snippet like Do you have a
Doctype? Does the page trigger quirks mode in IE?)
Anyone willing
to offer a hint or suggestion as to why the outer container retains
the width of the inner container, instead of auto-clearing both sides
and instead of growing to the size of the container holding everything?
It isn't, the outer_container will be as wide as #container if you add a
border to it your will see that it will look like a "line" the width of
#container- and margins or padding. What you will also note is it
will *not* look like a box containing the floating child DIV.

>
<div id="container"><!-- container -->

...

<div><!-- outer_container -->
<!-- http://google2.fda.gov/search?q=canola -->
<div style="width:500px;float:left;margin:1.25em auto;border:1px #AA0000 solid;padding:1.25em;clear:both;">
<form action="http://google2.fda.gov/search" method="get">
<p>Please enter what you want to find at the F.D.A. Type <i>canola</ior <i>rapeseed</iinto the text box below.</p>
<p class="pc"><b>Enter Words</b>: <input type="text" name="q" style="width:300px;" /><br />
<input type="submit" value="Submit" /></p></form>
Add a clearing element here to keep float from breaking out of the
bottom of "outer_container"
</div><!-- outer_container --></div>

...

<!-- container --></div>

I tried the following styles for the outer_container:

<div style="width:100%;"><!-- outer_container -->
<div style="width:auto;"><!-- outer_container -->
Or add <div style="overflow: hidden;"><!-- outer_container -->
to get outer_container to "contain" the float. See

http://www.quirksmode.org/css/clearing.html
CSS - Clearing floats

for more on the subject.
>
I must be missing out on something...

microcosmotalk dot com/live/health/canola/#canola_more_information
Oh, is this the page? TIP: learn what an external stylesheet is...

--
Take care,

Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com
Sep 20 '08 #2
In article <48**********************@unlimited.newshosting.co m>,
"Jim Carlock" <jc******@127.0.0.1wrote:
I ran into a problem a think. Either that or I overlooked something.
I seem to run into this problem quite often. I fail to pinpoint the
problem and it appears as a bug with mozilla browsers. Anyone willing
to offer a hint or suggestion as to why the outer container retains
the width of the inner container, instead of auto-clearing both sides
and instead of growing to the size of the container holding everything?
<http://netweaver.com.au/floatHouse/>

--
dorayme
Sep 21 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: trialproduct2004 | last post by:
hi all i am having application which is using two classes. in one class i am creating instance of another class and calling method of that class. what i want is from inner class's method i want...
4
by: Newbie | last post by:
I need to iterate through all the cells in an HTML-like table, e.g. <for-each select="tr"> <for-each select="td"> Get coordinates of cell here </for-each> </for-each> How can I access my...
0
dmjpro
by: dmjpro | last post by:
is there any difference between web-container and servlet container as the web-server and application server???? any help is most welcome...
0
by: swift2013 | last post by:
I have a paragraph which has width=200px and is contained in a div. The div is placed within the table cell, which has width=50px In IE6, Firefox 2.0.0.6 the div has offsetWidth of 200px, but...
4
by: Neelesh2007 | last post by:
I am using Datareport in a VB6.0 project with Access as backend. My code work fine with my PC. Also I have installed the project in several other PC's. (I have created setup with Visual Studio...
0
by: labmonkey111 | last post by:
I'm trying to get a list of page links for a report, and I'm running into a problem with IE. I have a group of nested left-floating DIVs for the page menu, inside a table. Firefox expands the size of...
1
pradeepjain
by: pradeepjain | last post by:
Hii guys, I might be silly to ask this ques..but seriously i did not understand the outer join and inner join in mysql site.i understood left and right join also. can some one explain...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.