Zen Cart Logo
Forums / Templates, Stylesheets, Page Layout / category image - weird float behavior

category image - weird float behavior

Locked

Views: 1,275

Results 1 to 5 of 5
This thread is locked. New replies are disabled.
15 Nov 2007, 5:48 AM
#1
quentinjs avatar

quentinjs

Zen Follower

Join Date:
Mar 2004
Location:
Calgary, Alberta
Posts:
289
Plugin Contributions:
0

category image - weird float behavior

I have a weird problem when I do the following: (example: http://www.totalgarage.ca/products/index.php?main_page=index&cPath=29 )

img.floatLeft {
float: left;
clear: left;
margin: 4px;
}

I do this for the the category description to display an image in the Left Hand Corner. But when I do this the images for the sub-categories also shift over. How do I stop that from happening? I know it has to be simple....

Thanks in advance.

15 Nov 2007, 9:08 AM
#2
nimbuz avatar

nimbuz

Zen Follower

Join Date:
Oct 2007
Posts:
291
Plugin Contributions:
0

Re: category image - weird float behavior

Floats have to be cleared ofcourse.

Add this to the DIV which contains the image you're floating:

overflow:hidden; width:100%;

15 Nov 2007, 9:10 AM
#3
nimbuz avatar

nimbuz

Zen Follower

Join Date:
Oct 2007
Posts:
291
Plugin Contributions:
0

Re: category image - weird float behavior

Well, just add this to your CSS and all should be fine:

#categoryDescription {
overflow:hidden;
width:100%;
}

16 Nov 2007, 4:24 AM
#4
quentinjs avatar

quentinjs

Zen Follower

Join Date:
Mar 2004
Location:
Calgary, Alberta
Posts:
289
Plugin Contributions:
0

Re: category image - weird float behavior

Beautiful, worked fantasticly, the odds of me stumbling upon that is almost nil.

So what does this do?
overflow:hidden;
width:100%;

the width 100% I am assuming says take the entire containment space I'm entitled to. but te overflow is interesting.

16 Nov 2007, 4:28 AM
#5
nimbuz avatar

nimbuz

Zen Follower

Join Date:
Oct 2007
Posts:
291
Plugin Contributions:
0

Re: category image - weird float behavior

It clears floating objects in a container, without requising any markup.

overflow:hidden; does the trick, width is just an IE hack.