473,385 Members | 1,925 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.

Float in IE/FF

Hello,

the page
http://www.moon2.de/float.htm
is displayed in IE as I would expect (the second block right beside the
first).
But in FF only the header ("Blabla") of the second block is floating
beside the first one, the rest is beneath it.

Why?

Regards,
André

May 29 '06 #1
5 1620
here you go
you forget one "float:left"
<DIV>
<DIV style="FLOAT: left">Lala
<DIV><IMG src="reloaded.files/kritzel.gif"></DIV>Lorem Ipsum </DIV>

<DIV style="float:left">Blabla
<DIV style="WIDTH: 150px"><IMG
src="reloaded.files/kritzel.gif"></DIV>Loremipsum
</DIV>
</DIV>

May 29 '06 #2

da*******@gmail.com schrieb:
here you go
you forget one "float:left"
<DIV>
<DIV style="FLOAT: left">Lala
<DIV><IMG src="reloaded.files/kritzel.gif"></DIV>Lorem Ipsum </DIV>

<DIV style="float:left">Blabla
<DIV style="WIDTH: 150px"><IMG
src="reloaded.files/kritzel.gif"></DIV>Loremipsum
</DIV>
</DIV>


I don't understand why.
Doesn't "float: left" mean that all following block elements go right
beside the element that has "float: left" set until there is one with
"clear"?

May 29 '06 #3
an***@webkr.de wrote:
Hello,

the page
http://www.moon2.de/float.htm
is displayed in IE as I would expect (the second block right beside the
first).
But in FF only the header ("Blabla") of the second block is floating
beside the first one, the rest is beneath it.

Why?


Reason:
The div's width containing the 2nd image is defined as 150px and is
calculated from the extreme left edge.
100px is already used up by the 1st image, leaving only 50px.
The text "Blahbla" fits in the remaing 50px.
The 2nd image being 100px wide does not fit in the remaining 50px.
So it's moved down to where it will fit. Fx and Opera get it right. IE
gets it wrong.
Apply a border to your divs to see what is going on.
Solution:
Apply margin-left:100px; to the 2nd wrapper div and all browsers will
render alike.

Davy gives another solution by floating both wrappers.
The second float's left edge is calculated from the first float's right
edge.

If, on the other hand, you wish to have both wrapper divs rendered above
each other by all browsers,
then apply a clear:left; to the second wrapper div.

--
Gus
May 29 '06 #4
thanx Gus ,i only know the solution and you tell me why:D

here comes another question:
if I defined an element's width just like in this case,the element's
position attribute changes to "absolute"?

I tried switch the position in the 2nd img div like this: <div
style="width: 150px;position:relative;"><img src="kritzel.gif"></div>
and also "static" "absoulte"

but it seems no effect as long as I defined width. If I remove the
width attribute,relative position and static has no difference

I'm pretty confused by float and position ,if it too long to explain
,any existing article can help me? thanx a lot~

May 30 '06 #5
da*******@gmail.com wrote:

I'm pretty confused by float and position ,if it too long to explain
,any existing article can help me? thanx a lot~


There are probably many sites which you can find. Here is one that I
have found just now:

http://www.html.net/tutorials/css/introduction.asp

--
Gus
May 31 '06 #6

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...
14
by: Glen Able | last post by:
Should it be possible to create a custom class, 'Float', which would behave as a drop-in replacement for the builtin float type? As mentioned in another thread, I once tried this in rather a...
16
by: Gerald Lafreniere | last post by:
{ float F=123.456000; F*=1000; // Actually I used a for loop F*=10 three times. printf("%f\n", F); } This will produce something like 123456.00XXXX, where XXXX are garbage digits. Why...
6
by: Dave win | last post by:
Hi all: I'm confused with the expression "(float *())". Book says that this is a cast. But, I have no idea of this expr. why could this expr ignore the variable??? Thanx!!!
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: 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...
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: 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: 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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...

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.