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

Floats, Firefox, and overflow

Example page:

http://www.splatteredink.net/test/

It is a two column layout with header. The header and two columns are in a
container div. The left column is floated left. The text of the left column
is in a div nested within the left column div because of the box-model
hack. There is another hack using margins to get the right column clear of
the left one in non-IE browsers.

The problem is that in Firefox 1.0 the container only extends as far down
as the right column, thus the left column overflows outside the container.
The layout looks fine (container extends all the way to the bottom of the
left column) in Opera 7.5 and IE6.

The first fix that I thought of was to use height: 100% on the container
div, but this did not do anything.

I then applied a float to the container div, and this made the container
actually contain both columns. However, doing this made the page not
centered anymore.

Perhaps my question is how to center a float: left.

Too bad there isn't a float: center.

The reason I floated the left column instead of the right column is because
it was desirable to have the unformatted HTML file's 'left column' above
the 'right column'. I also wanted to avoid absolute positioning.

any ideas? Should I compromise and just float the right column, or is
there another answer?

thank you for your time.

d.
Jul 21 '05 #1
6 5879
Hey,
What i do i use a 1 px horizontal background line picture for a whole
content div.
Something like that:
div.centered { width: 780px; margin:0 auto 0 auto;
background-image:url(../../G/layout/background_centered.gif);background-repeat:y;}You
can see the results on http://ksi.mikronika.com.pl:88/mikronika/Hope it will
help,Luke"Drue" <xrintrahx@(nospam)yehoo.com> wrote in message
news:Xn*******************************@199.45.49.1 1...
Example page:

http://www.splatteredink.net/test/

It is a two column layout with header. The header and two columns are in a
container div. The left column is floated left. The text of the left
column
is in a div nested within the left column div because of the box-model
hack. There is another hack using margins to get the right column clear of
the left one in non-IE browsers.

The problem is that in Firefox 1.0 the container only extends as far down
as the right column, thus the left column overflows outside the container.
The layout looks fine (container extends all the way to the bottom of the
left column) in Opera 7.5 and IE6.

The first fix that I thought of was to use height: 100% on the container
div, but this did not do anything.

I then applied a float to the container div, and this made the container
actually contain both columns. However, doing this made the page not
centered anymore.

Perhaps my question is how to center a float: left.

Too bad there isn't a float: center.

The reason I floated the left column instead of the right column is
because
it was desirable to have the unformatted HTML file's 'left column' above
the 'right column'. I also wanted to avoid absolute positioning.

any ideas? Should I compromise and just float the right column, or is
there another answer?

thank you for your time.

d.

Jul 21 '05 #2
Drue <xrintrahx@(nospam)yehoo.com> wrote in message news:<Xn*******************************@199.45.49. 11>...
http://www.splatteredink.net/test/

The problem is that in Firefox 1.0 the container only extends as far down
as the right column, thus the left column overflows outside the container.
The layout looks fine (container extends all the way to the bottom of the
left column) in Opera 7.5 and IE6.
I don't know of anything in any CSS spec that would suggest that such
behavior is correct. I'm not surprised IE/Windows is doing it
(probably thanks to #cont { width: 700px; }, which switches IE/Windows
into using its second type of block), but I'm a little surprised about
Opera.
I then applied a float to the container div, and this made the container
actually contain both columns. However, doing this made the page not
centered anymore.
This works because, in CSS 2.1 terminology, a float is one of the
things that establishes a new block formatting context, and the
definition of 'height: auto' (the default) for such elements means
they grow to contain floats.
any ideas? Should I compromise and just float the right column, or is
there another answer?
Another answer would be the rule:

#cont:after {
display: block;
content: " ";
clear: both;
}

-David

--
L. David Baron <URL: http://dbaron.org/

Jul 21 '05 #3
in comp.infosystems.www.authoring.stylesheets, L. David Baron wrote:
Drue <xrintrahx@(nospam)yehoo.com> wrote in message news:

The problem is that in Firefox 1.0 the container only extends as far down
as the right column, thus the left column overflows outside the container.
The layout looks fine (container extends all the way to the bottom of the
left column) in Opera 7.5 and IE6.
I don't know of anything in any CSS spec that would suggest that such
behavior is correct.
I'm a little surprised about Opera.


Quirks mode. Anyway, now it trickers standards mode in my 7.6p3, and does
show things correctly (like FF).

It trickers quirks in IE, I assume, because doctype has extra whitespace,
I then applied a float to the container div, and this made the container
actually contain both columns. However, doing this made the page not
centered anymore.
It is undefined, is could just as well not contain them...
any ideas? Should I compromise and just float the right column, or is
there another answer?


#cont {display:table;}
Another answer would be the rule:

#cont:after {
display: block;
content: " ";
clear: both;
}


Does it work on Gecko? It has worked on Opera for few years...

--
Lauri Raittila <http://www.iki.fi/lr> <http://www.iki.fi/zwak/fonts>
Jul 21 '05 #4
in comp.infosystems.www.authoring.stylesheets, Luke wrote:
Hey,
You top posting. As usual, it means you didn't read OPs post.
What i do i use a 1 px horizontal background line picture for a whole
content div.


OP is asking different question, and your solution is not suitable for
that. His problem was that content div was not long enaugh, not that
column was too short.
--
Lauri Raittila <http://www.iki.fi/lr> <http://www.iki.fi/zwak/fonts>
Jul 21 '05 #5
Lauri Raittila <la***@raittila.cjb.net> wrote in message news:<MP************************@news.individual.n et>...
in comp.infosystems.www.authoring.stylesheets, L. David Baron wrote:
Another answer would be the rule:

#cont:after {
display: block;
content: " ";
clear: both;
}


Does it work on Gecko? It has worked on Opera for few years...


Yes. It works in both current trunk and in 0.9.9 (the oldest version
I have around, from March 2002).

-David

--
L. David Baron <URL: http://dbaron.org/ >
Jul 21 '05 #6
Lauri Raittila <la***@raittila.cjb.net> wrote in
news:MP************************@news.individual.ne t:
#cont {display:table;}


Thank you both for your suggestions. Both bits of code fixed the float
problem, however I ultimately went with L. David Baron's suggestion. The
above code, once applied to another page, did strange things to div and p
background images.

Thanks again.

d.
Jul 21 '05 #7

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

Similar topics

18
by: Niels | last post by:
Hi group, I have some problems with clearing floated divs. My usual method works fine in Konqueror, but not in Firefox. Here's an example: <html><body> <div id='left' style='float:left;...
6
by: paulroskilly | last post by:
Hello, Can anyone help with this, I have a div tag : <div style="overflow:scroll; overflow-x:hidden; height=315px"> In IE this renders the DIV fine, it is 315 pixels high and has a...
8
by: Tom | last post by:
Has anyone ever seen a IComparer for floats the returns magnitude. i.e. instead of returning -1, it would return -5. To let you know HOW different the two numbers are. obviously for int it is a -...
2
by: matthewmacchia | last post by:
I believe this is a Firefox bug but I was hoping someone found a workaround. I have implemented drag and drop functionality, but if I try to drag an element from a div that happens to have a div...
6
by: alejandro | last post by:
I just noticed that in FireFox, onmouseover and onmouseout events do not work properly when a div's overflow is set to hidden/auto/scroll. If you click and hold inside the div with onmouseover/out...
2
by: esteuart | last post by:
I need to get the right combination for a div to clip any text inside and allow vertical alignment. I only have this problem in FireFox. I have 3 divs nested within each other. The outer div has...
4
by: sbettadpur | last post by:
hello, i have created one website using div i.e total layout is designed using div only. if i saw that pages in Internet Explorer vesion 6, its showing very fine, but if i open same pages in...
7
by: randaldesign | last post by:
I can't show you the markup because the project is still under-wraps, but I've got a situation where floats behave as expected in all the browsers except FireFox. (Safari, IE) In some instances,...
1
by: newbie009 | last post by:
How can I disable horizontal scroll in textbox for FireFox? Right now 1 textbox has vertical scroll and other textbox has horizontal scroll. It only looks like this on FireFox but it looks ugly....
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: 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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...
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
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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,...

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.