473,382 Members | 1,749 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,382 software developers and data experts.

float breaking out of box

I have a floated container that is breaking out of it's containing
block. I don't remember the tricks to fix that (sorry Dorayme).

Jeff
Sep 9 '08 #1
5 4101
Jeff wrote:
I have a floated container that is breaking out of it's containing
block. I don't remember the tricks to fix that (sorry Dorayme).

Floats don't contribute to the height of their containers, as they are
considered "out of the flow". Therefore, you need some way to give the
container some height.

Some things you can do about this include setting overflow:hidden; (or
any value besides "visible") or position:absolute; on the container.

--
John
The possessive pronoun, "its", has no apostrophe. Even on the Internet.
Sep 9 '08 #2
Jeff schrieb:
I have a floated container that is breaking out of it's containing
block. I don't remember the tricks to fix that (sorry Dorayme).
Here's what I use:

--- common.css ---
#container:after
{
clear: both;
display: block;
height: 0;
content: ".";
visibility: hidden;
}

--- ie.css ---
#container
{
zoom: 1;
height: 1px;
he\ight: auto;
}

--- page.html ---
<link rel="stylesheet" media="all" type="text/css" href="common.css">
<!--[if IE]><link rel="stylesheet" href="ie.css"><![endif]-->

For standard compliant browsers supporting the content property, we
simply add an additional block at the end of #container and have it
clear the float.

IE does not support the content property, but has a proprietary internal
property called "layout". If this is set, a side effect will be that all
floated children will be enclosed by their #container. To set it (can't
be done directly), use either the proprietary zoom property or assign a
height. The above solution caters for IE5 and above.

Greetings,
Thomas

--
Ce n'est pas parce qu'ils sont nombreux à avoir tort qu'ils ont raison!
(Coluche)
Sep 9 '08 #3
In article <Qa******************************@earthlink.com> ,
Jeff <jeff@spam_me_not.comwrote:
I have a floated container that is breaking out of it's containing
block. I don't remember the tricks to fix that (sorry Dorayme).

Jeff
Well, Jeff, perhaps you lost the link to my

<http://netweaver.com.au/floatHouse/>

In the face page, see sections 6, 7 and 8.

But, briefly (how I hate brevity):

Use overflow: hidden or overflow: auto on the parent container. But
safest probably is to stick in a non floated child with a style="clear:
both;" on it after the floats. That makes the parent sit up and listen
even for IE6. I say safest because I have seen occasional situations in
IE6 where the parent does not grow height naturally for its floated
children and it will not be forced to do so by overflow instructions. I
recall it was you who brought this to my attention once!

--
dorayme
Sep 10 '08 #4
dorayme wrote:

Hello Dorayme,
In article <Qa******************************@earthlink.com> ,
Jeff <jeff@spam_me_not.comwrote:
> I have a floated container that is breaking out of it's containing
block. I don't remember the tricks to fix that (sorry Dorayme).

Jeff

Well, Jeff, perhaps you lost the link to my

<http://netweaver.com.au/floatHouse/>
Thanks, Lost in the clutter!
>
In the face page, see sections 6, 7 and 8.

But, briefly (how I hate brevity):

Use overflow: hidden or overflow: auto on the parent container.
That I had forgotten.
But
safest probably is to stick in a non floated child with a style="clear:
both;" on it after the floats. That makes the parent sit up and listen
even for IE6.
That I could not do. I had a bit of javascript that toggled the next
node on/off.

I say safest because I have seen occasional situations in
IE6 where the parent does not grow height naturally for its floated
children and it will not be forced to do so by overflow instructions. I
recall it was you who brought this to my attention once!
It was indeed!

I've been insanely busy, I still have something for you...

Thanks,
Jeff
>
Sep 10 '08 #5
Thomas Mlynarczyk wrote:
Jeff schrieb:
> I have a floated container that is breaking out of it's containing
block. I don't remember the tricks to fix that (sorry Dorayme).

Here's what I use:

--- common.css ---
#container:after
{
clear: both;
display: block;
height: 0;
content: ".";
visibility: hidden;
}

--- ie.css ---
#container
{
zoom: 1;
height: 1px;
he\ight: auto;
}
I find this absolutely fascinating. I had never used the after pseudo
element.
>
--- page.html ---
<link rel="stylesheet" media="all" type="text/css" href="common.css">
<!--[if IE]><link rel="stylesheet" href="ie.css"><![endif]-->

For standard compliant browsers supporting the content property, we
simply add an additional block at the end of #container and have it
clear the float.

IE does not support the content property, but has a proprietary internal
property called "layout". If this is set, a side effect will be that all
floated children will be enclosed by their #container. To set it (can't
be done directly), use either the proprietary zoom property or assign a
height. The above solution caters for IE5 and above.
Thanks. I'm still soaking some of it up...

Jeff
>
Greetings,
Thomas
Sep 10 '08 #6

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

Similar topics

1
by: maxim vexler | last post by:
in a book i am ready now : O'Reilly - Web Database Application with PHP and MySQL, 2nd ed. by David Lane, Hugh E. Williams on chapter 9 the author give an example for age validation :...
0
by: Nick Coghlan | last post by:
<Sorry for the disconnected reply -I've been having news server issues, and just switched to the mailing list instead> A quick check of the source code reveals that this behaviour is deliberate....
27
by: Curtis Morrison | last post by:
Please help! I've been trying to figure this out for days now, with no luck. the following web page loads fine in MSIE, but NN 7 breaks it. I would really appreciate any suggestions that anyone...
54
by: Andy | last post by:
Hi, I don't know if this is the correct group to post this, but when I multiply a huge floating point value by a really small (non-zero) floating point value, I get 0 (zero) for the result. This...
53
by: Zhiqiang Ye | last post by:
Hi, All I am reading FAQ of this group. I have a question about this: http://www.eskimo.com/~scs/C-faq/q7.31.html It says: " p = malloc(m * n); memset(p, 0, m * n); The zero fill is...
6
by: Steve | last post by:
Hi, I've developed a testing application that stores formatted results in a database. Recently it was requested that I add the ability to generate graphs from the raw, un formatted test results...
8
by: d major | last post by:
I was very puzzled about the conversion between float and long, I cann't understand why a long val can convert to a float, as the below codes show: typedef unsigned long u_long; float val =...
1
by: spoonybard | last post by:
Hi Everyone, I have a tableless website design and I am trying to add the feature to print the middle column content on one of my pages. The information that is being displayed is a two column...
2
by: Jim Carlock | last post by:
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....
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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...

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.