473,324 Members | 2,535 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,324 software developers and data experts.

Re: Float and Shrinkwrap

On 2008-04-08, Gus Richter <gu********@netscape.netwrote:
dorayme wrote:
>>
I am inclined to actually use the phrase "containing block" where the
context shows it to do a job of containing.

Because the point is that it is the container, the parent, the big house
where the children live... It is crucial that it is on the container,
the parent, that rel pos is made for the abs to work.

And I find it interesting how the "layers" work and yet the float still
exerts the influence to push aside (displace) the text or pics in the
following divs. Just had never thought of the float rules operating from
a smothered "underneath" position! Those float rules are powerful voodoo
huh? <g>

1. Any floated item will be out of the normal flow.
2. When floated left, it will position itself to top,left (0,0) of its
"container block".
3. The special feature of a float is that any inline box content in the
"container box" will shift over to make room for the float.
4. Blah, blah, blah, blah.

You are having difficulty in accepting the container thing, so try
asking yourself:
"If the float positions itself to 0,0 of the container block,
then what could be the container block?"
Sometimes 0,0 of more than one container blocks occupy the same pixel on
the screen, so this is not a good criterion.

body
float
div

In this example, 0,0 of div and body are in the same place because of
margin collapsing.

So which is the containing block for the float? Body, not the div,
because it's the block level ancestor as specified.
Jun 27 '08 #1
2 2775
Ben C wrote:
On 2008-04-08, Gus Richter <gu********@netscape.netwrote:
>dorayme wrote:
>>I am inclined to actually use the phrase "containing block" where the
context shows it to do a job of containing.

Because the point is that it is the container, the parent, the big house
where the children live... It is crucial that it is on the container,
the parent, that rel pos is made for the abs to work.

And I find it interesting how the "layers" work and yet the float still
exerts the influence to push aside (displace) the text or pics in the
following divs. Just had never thought of the float rules operating from
a smothered "underneath" position! Those float rules are powerful voodoo
huh? <g>
1. Any floated item will be out of the normal flow.
2. When floated left, it will position itself to top,left (0,0) of its
"container block".
3. The special feature of a float is that any inline box content in the
"container box" will shift over to make room for the float.
4. Blah, blah, blah, blah.

You are having difficulty in accepting the container thing, so try
asking yourself:
"If the float positions itself to 0,0 of the container block,
then what could be the container block?"

Sometimes 0,0 of more than one container blocks occupy the same pixel on
the screen, so this is not a good criterion.

body
float
div

In this example, 0,0 of div and body are in the same place because of
margin collapsing.

So which is the containing block for the float? Body, not the div,
because it's the block level ancestor as specified.
I agree.
My explanation of 0,0 of the container block fits simplistically.
The following condenses the spec a little more in detail:

1. Any floated item will be out of the normal flow.
2. A float will position itself to the _top_ of any "block", "float" or
"line box" earlier in the source (further rules are provided in the case
of collapsing margins).
3. When floated left, it will position itself to the _left_ of its
"containing block" and when floated right, it will position itself to
the _right_ of its "containing block" (further rules are provided in the
case of collapsing margins).
[A "Containing Block" is a generated box for the content/descendants
and the containing block's behavior is determined by the "type" of box
generated.]
4. The special feature of a float is that any inline box content in the
"container box" will shift over to make room for the float.

Caveat: Although I "got it" when I wrote it, I find on re-reading that I
have to reference the spec (bad part: in several different chapters) to
see what I was talking about. So it needs quite a few more re-reads for me.

--
Gus
Jun 27 '08 #2
On 2008-04-10, Gus Richter <gu********@netscape.netwrote:
[...]
The following condenses the spec a little more in detail:

1. Any floated item will be out of the normal flow.
2. A float will position itself to the _top_ of any "block", "float" or
"line box" earlier in the source (further rules are provided in the case
of collapsing margins).
Not earlier in the source but up the tree.

It goes to the top of the current line box provided that putting it
there doesn't mean that the line breaks such that text before the float
ends up on the line box beneath it. In that case it goes at the top of
the next line box. Firefox 2 and IE always put it at the top of the next
line box anyway although this is technically wrong.
3. When floated left, it will position itself to the _left_ of its
"containing block" and when floated right, it will position itself to
the _right_ of its "containing block"
Yes, although it might not make it all the way to the left or right if
there are other floats already in the way.
(further rules are provided in the case of collapsing margins).
Collapsing margins don't affect how far to the left or right it goes
(well not directly, although they might influence the position of other
floats).

[...]
4. The special feature of a float is that any inline box content in the
"container box" will shift over to make room for the float.
Yes although the inline boxes don't have to be in the same container.

<div>
<tall float that sticks out of the bottom>
</div>
<div>
This text will shift over to make room for the float in the div
above.
</div>
Jun 27 '08 #3

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

Similar topics

5
by: Pat | last post by:
Give two double-typed variable X and Y. If (X==Y) is true, then how about the following results: (float(X) > float(Y))? (float(X) < float(Y))? (float(X) >= float(Y))? ( X > float(Y) )? ( X...
9
by: Sisyphus | last post by:
Hi, I have some software that does the following (in an attempt to determine whether the double x, can be represented just as accurately by a float): void test_it(double x) { float y = x;...
11
by: Marc Pelletier | last post by:
Hello, I am having trouble implementing the following callback: CNCSError CECWCompressor::WriteReadLine(UINT32 nNextLine, void **ppInputArray) where ppInputArray is a 3 by x array. The...
20
by: ehabaziz2001 | last post by:
That program does not yield and respond correctly espcially for the pointers (*f),(*i) in print_divide_meter_into(&meter,&yds,&ft,&ins); /*--------------pnt02own.c------------ ---1 inch = 2.51...
8
by: Brian Kendig | last post by:
I have a page which should have a "sidebar" to the left, and a "main" block of content to the right. I want to represent each block as a <div>, and I thought I could do this by having "float: left"...
8
by: vjnr83 | last post by:
Hi, I have a doubt: what is the difference between float **p and float *p? Thanks in advance, Vijay
13
by: Shirsoft | last post by:
I have a 32 bit intel and 64 bit AMD machine. There is a rounding error in the 8th digit. Unfortunately because of the algorithm we use, the errors percolate into higher digits. C++ code is...
3
by: Arnie | last post by:
Folks, We ran into a pretty significant performance penalty when casting floats. We've identified a code workaround that we wanted to pass along but also was wondering if others had experience...
3
by: Ben C | last post by:
On 2008-04-07, Gus Richter <gusrichter@netscape.netwrote: No the containing block for a float is always above it in the document tree. But floats "invade" subsequent blocks in the same block...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.