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

float problems

float, among other css attributes, is not working as i'd expect it to
on the following webpage:

http://www.frostjedi.com/terra/dev/test.html

In Internet Explorer, there's a space between the yellow div and the
light blue div that I don't believe should be there. Also, the red div
has a height that is quite clearly more than the 1px that it should be.

Neither of these problems are present in Firefox, but Firefox's
rendering isn't without flaw, either. Specifically, the yellow div,
and the other divs contained within it, are offset by an amount equal
to the margin-height of the pink div. This seems to be caused by the
fact that the red div (ie. the div immediatly preceeding the pink one)
has a float:left in it. The following page better demonstrates this:

http://www.frostjedi.com/terra/dev/test2.html

Is there anything I can do to make both of these webpages render in the
same manner, while still using floats?

Jul 21 '05 #1
3 2258
yawnmoth wrote:

http://www.frostjedi.com/terra/dev/test.html

the red div
has a height that is quite clearly more than the 1px that it should be.
Why do you have a div for this at all? Seems to me a 1px red bottom
border on the blue box would do the job nicely and not cluter up the
HTML with more junk than it really needs. You already have a case of
div-soup started, don't need to make it worse.

BTW, WinIE's default overflow behavior is broken. Instead of confining a
box to its specified dimensions, it automatically expands it to fit the
content. That content size can be affected by other properties, such as
font-size, line-height and default margins.

The typical method to stop this stoopid behavior is overflow:hidden, but
sometimes you need to set the other properties, too. Also beware that
MacIE is rather buggy with overflow.
Firefox's rendering isn't without flaw, either.

http://www.frostjedi.com/terra/dev/test2.html

Is there anything I can do to make both of these webpages render in the
same manner, while still using floats?


I don't know what you are trying to accomplish, so it's hard to suggest
anything. But I will hazard a guess that replacing the 1px red div with
a border and dropping the explicit margins would be a step in the right
direction.

--
Reply email address is a bottomless spam bucket.
Please reply to the group so everyone can share.
Jul 21 '05 #2
yawnmoth wrote:
float, among other css attributes, is not working as i'd expect it to
on the following webpage:

http://www.frostjedi.com/terra/dev/test.html

In Internet Explorer, there's a space between the yellow div and the
light blue div that I don't believe should be there. Also, the red div
has a height that is quite clearly more than the 1px that it should be.

Neither of these problems are present in Firefox, but Firefox's
rendering isn't without flaw, either. Specifically, the yellow div,
and the other divs contained within it, are offset by an amount equal
to the margin-height of the pink div. This seems to be caused by the
fact that the red div (ie. the div immediatly preceeding the pink one)
has a float:left in it. The following page better demonstrates this:

http://www.frostjedi.com/terra/dev/test2.html

Is there anything I can do to make both of these webpages render in the
same manner, while still using floats?


maybe instead of limiting the body size to 600px you could add a div
that wraps around all your complete div-group, like:

body {
background: black;
text-align: center;
}

<div style="display: table; width: 600px; margin-top: 50px; margin-left:
auto; margin-right: auto; border: 2px solid white;">
<!-- your div group here -->
</div>

and like kchaya already said: a div of 1px height looks a little
useless, why dont you simple add a margin-bottom: 1px; on the blue div ?!

finally, i think your page renders in both IE and FF similar when you
would add float: left to the yellow div.

btw .. there are many examples of css-tables on the net, you could do
yourself a favor and have a look at some of them.

gr
martin


Jul 21 '05 #3

Ali Babba wrote:
yawnmoth wrote:

<snip>

and like kchaya already said: a div of 1px height looks a little
useless, why dont you simple add a margin-bottom: 1px; on the blue div ?!

i guess i could do that, heh. i actually only included it because i
was curious why it wasn't working as expected.
finally, i think your page renders in both IE and FF similar when you would add float: left to the yellow div.


that worked - thanks! :)

Jul 21 '05 #4

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

Similar topics

6
by: Bengt Richter | last post by:
Peculiar boundary cases: >>> 2.0**31-1.0 2147483647.0 >>> int(2147483647.0) 2147483647L >>> int(2147483647L ) 2147483647 >>> >>> -2.0**31
11
by: Dan Rubin | last post by:
HI everyone, lurking for a long time here, since I can usually solve my own problems, but here is one I'm stumped by. I've got a valid XHTML 1.0 Transitional layout, and all the CSS is valid as...
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...
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...
13
by: maadhuu | last post by:
hello , i would like to know as to why double is more efficient than float . thanking you, ranjan.
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...
116
by: Dilip | last post by:
Recently in our code, I ran into a situation where were stuffing a float inside a double. The precision was extended automatically because of that. To make a long story short, this caused...
23
by: JDT | last post by:
Hi, It seems that using floats as the first tupelo for an STL map (shown below) can cause problems but I don't remember what the problems were. Is it common practice to use a structure like...
14
by: Jim Langston | last post by:
The output of the following program is: 1.#INF 1 But: 1.#INF 1.#INF was expected and desired. How can I read a value of infinity from a stream?
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: 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
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.