Link to home
Start Free TrialLog in
Avatar of Rowby Goren
Rowby GorenFlag for United States of America

asked on

Keeping an image within a div

I think this is a float / clear float issue, which I don't have my brain quite wrapped around yet...

Please go to this page, work in progress :):

http://brentwoodvillagemarket.com/index.php?option=com_virtuemart&page=shop.browse&category_id=20&Itemid=80

Whenever there is an image for one of the sandwiches, I need to make sure that the bottom dotted border line has some nice padding after the product image -- if there is an image present..

As you can see, the image for the "Thanks A Lot" sandwich slightly overlaps the bottom dotted line border.  That's my problem .

The "Wise Guy" sandwich doesn't have this problem only because there is some text in the description of the sandwich.

And the sandwiches which do not have images appear to be behaving with nice padding, etc.

They are all within a container called  <div class="s5_browseProductContainer">

So, as I said,  I think the problem may have something to do with floats and clearing floats -- and maybe there needs to be some divs added or rearranged if necessary????

Below is the php code.  I promise not to touch it until you folks are finished here.

Thanks
Rowby
<div class="s5_browseProductContainer">
  <h2><?php echo $product_name ?>  </h2>
    <p ><?php echo $product_price ?></p>
 <div id="rowby-thumb"> <?php echo ps_product::image_tag( $product_thumb_image, 'class="browseProductImage" border="0" title="'.$product_name.'" alt="'.$product_name .'"' ) ?><br style="clear:both;" /><div align="center"></div>
   <br style="clear:both;" /></div> 
    <?php echo $product_desc ?>
  <?php echo $form_addtocart ?>
 </div>

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of cmaohio
cmaohio
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Rowby Goren

ASKER

Hi cmaohio,

All of the images are the same height so I tried adding minimum height.

However for the products where there are no images the div says the same height.  

You can see that here.  http://brentwoodvillagemarket.com/index.php?option=com_virtuemart&page=shop.browse&category_id=20&Itemid=80

I would like to only have those with images be that minimum height.

I realize this may be beyond css and may require some php...    Or is there still a solution in CSS?

Thanks

Rowby
Well, in the case where there is no image, then you can do an If/then statement in PHP which then omits the min-height directive within the tag itself. It requires you use the style tag within the div instead of in the .css file but it will solve your problem.

I don't exactly know if there is a CSS solution to it other than using a table (there are still uses for tables in design sometimes) or using a DD list.

Check out http://www.kofc11207.org/officers.php

Actually now that I think of it, that example above I have it variable height with the line in between. Although the line may be simply a DIV border. I don't remember, check the source.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hi, cresQ:

Thanks for helping.  I have to leave for today but will try your solution on Tuesday.

Stay tuned!!

Rowby
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hi  everyone

Thanks for all your help.

Stay tuned. I will be finishing up this question today or thursday the latest.

Rowby
Avatar of wilson1000
wilson1000

Great :o)

I just tested and it works although I have notioced something which will probably cause you problems; the ID:  'rowby-thumb' is repeated multiple times throughout the page. This is semantically incorrect and as I said, might cause an issue.

Thanks for your help.  I will be using a combination of your solutions to get it fixed.

If I run into problems I'll update it with a new question.

Wanted to get these points awarded while fine tune the site.

Rowby