473,698 Members | 2,524 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2275
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
2082
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
2794
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 well (plenty of warnings, but I'm not worried about that), and I'm making use of the float property without any problems EXCEPT for one page (coloured backgrounds added for clarity): http://autographquartet.com/contact.php
14
2710
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 hurry to try and catch some floating point naughtiness, but was stumped in various places. Is there a fundamental obstacle to doing this? thanks, G.A.
54
8357
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 creates a big hole in a 32-bit timer routine I wrote. Questions. 1. Why does this happen? 2. Is there C macros/functions I can call to tell me when two non-zero numbers are multiplied and the
13
3333
by: maadhuu | last post by:
hello , i would like to know as to why double is more efficient than float . thanking you, ranjan.
20
3137
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 cm ---1 inch = 2.54/100 Meter ---1 yard = 3 feet ---1 feet = 12 inch
116
35873
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 problems elsewhere in another part of the system where that figure was used for some calculation and some eventual truncation led to the system going haywire. So my question is, given this code: int main() { float f = 59.89F;
23
9228
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 below? I would appreciate if you can share your experience using such a structure. Thanks. std::map<float, intm; JD
14
5538
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?
0
8609
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9166
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
7737
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6525
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4371
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4621
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3052
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2333
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2007
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.