473,385 Members | 1,888 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,385 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 2785
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: 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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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.