6 replies [Last post]
nvent
nvent's picture
User offline. Last seen 6 years 21 weeks ago. Offline
rank Regular
Regular
Joined: 2005-09-10
Posts: 35
Points: 0

Hello,

I've been using this method to do float containment:
http://www.quirksmode.org/css/clearing.html

I like that method because I can do it in the css without any more markup.

div.container {
border: 1px solid #000000;
overflow: hidden;
width: 100%;
}

And it really seemed to be awesome until I began noticing that in Firefox (PC and Mac), the overflow would actually hide, but only somtimes. As far as I can tell, it was only when the page was hit the first time. Upon a second visit or a refresh, it would display correctly. I tried using overflow: auto because of the hiding problem, but I'd like it to work like the example.

It works fine in IE 6 on the PC and Safari on the mac. Any ideas?

Here's the address of the page I'm working on:
http://www.dev.greenlighttoys.com/singleproduct.php?id=28&cat=29

thepineapplehead
thepineapplehead's picture
User offline. Last seen 6 days 17 hours ago. Offline
rank Guru
Guru
Joined: 2004-06-30
Posts: 9648
Points: 777

Css float containment: visibility method - firefox problems

Have you tried:

overflow: auto;

?

Verschwindende wrote:
  • CSS doesn't make pies

gary.turner
gary.turner's picture
User offline. Last seen 27 min 20 sec ago. Offline
rank Moderator
Moderator
Timezone: GMT-6
Joined: 2004-06-25
Posts: 7690
Points: 1506

Css float containment: visibility method - firefox problems

Besides {overflow: hidden;}, there is, as TPH said, {overflow: auto;}. See the css2.1 specs, section 10.6 or there abouts.

Too, you can use {display: table;} or {display: inline-block;}. Of these two, 'table' has more support. The inline-block thingie is in the above reference. I don't know where the table ref is (anybody? clue me in).

Then, there is Tony Aslett's elegant clearing hack, found on this site.

Each of these methods work, but circumstance can mean one or the other might have unintended consequences. You'll need to play with them until you get a feel for which will work better in a given case. Then you'll still have to test.

cheers,

gary

Unplanned code results in a tangled wad of brain-cramping confusion.

There are enough html & css demos and tutorials to be interesting. Please visit.

ClevaTreva
ClevaTreva's picture
User offline. Last seen 20 weeks 5 days ago. Offline
rank Guru
Guru
Timezone: GMT+1
Joined: 2004-02-05
Posts: 2902
Points: 0

Css float containment: visibility method - firefox problems

Hi

Don't forget, that when you use overflow:auto you often have to hack IE to give it overflow:visible, otherwise it often doesn't like matters.

Trevor

nvent
nvent's picture
User offline. Last seen 6 years 21 weeks ago. Offline
rank Regular
Regular
Joined: 2005-09-10
Posts: 35
Points: 0

Css float containment: visibility method - firefox problems

Sorry guys, I thought I made it clear; overflow: auto leaves scrollbars. It just does not work in firefox without a refresh. Strangely, it worked fine in IE.

nvent
nvent's picture
User offline. Last seen 6 years 21 weeks ago. Offline
rank Regular
Regular
Joined: 2005-09-10
Posts: 35
Points: 0

Css float containment: visibility method - firefox problems

kk5st wrote:
Besides {overflow: hidden;}, there is, as TPH said, {overflow: auto;}. See the css2.1 specs, section 10.6 or there abouts.

Too, you can use {display: table;} or {display: inline-block;}. Of these two, 'table' has more support. The inline-block thingie is in the above reference. I don't know where the table ref is (anybody? clue me in).

Then, there is Tony Aslett's elegant clearing hack, found on this site.

Each of these methods work, but circumstance can mean one or the other might have unintended consequences. You'll need to play with them until you get a feel for which will work better in a given case. Then you'll still have to test.

cheers,

gary

I have used the after clearing hack as well, I actually love that one but in this case I could not get it to work without a bunch of large gaps underneath my divs.

drhowarddrfine
drhowarddrfine's picture
User offline. Last seen 2 years 9 weeks ago. Offline
rank Leader
Leader
Timezone: GMT-6
Joined: 2005-05-21
Posts: 764
Points: 0

Css float containment: visibility method - firefox problems

You have prodlanding as a multiply defined 'id'.

IE7 is 10 years behind the standards or wrong.
But it works in IE!
IE is a cancer on the web -- Paul Thurott