Simple CSS help needed

cashcow

Junior Member
Joined
Sep 15, 2008
Messages
162
Reaction score
25
<DIV class=postwrapper style="clear:both;border-style:solid;">
<div class=post-title>

<div style="font-weight:bold; font-size:17px;"><a href="http://">Chocolate Basket</a></div>
</div>


<DIV class=post-content><div><img style='float:left;' src="bas08.jpg" border="0"/>This premium chocolate assortment is meant for true connoisseurs. The confections in this basket were crafted by the world-famous Ghirardelli, San Francisco's first chocolatier.</div></DIV>
</DIV>

tmpbasket.jpg


How come the border box is shorter than the image? What do I have to do to make the border box cover the image? (btw, I cannot change anything in class "post-content")
Can anyone help please?
 
Thanks Blatt, but unfortunately, it didn't work...
 
Because that's probably the height #post-content tells it to be. Why wouldn't you be able to change those properties?
 
Try adding a div with style="clear:both" like below. That should do it.

Code:
<DIV class=post-content><div>

<img style='float:left;' src="bas08.jpg" border="0"/>This premium chocolate assortment is meant for true connoisseurs. The confections in this basket were crafted by the world-famous Ghirardelli, San Francisco's first chocolatier.

[B]<div style="clear: both;"></div>[/B]

</div></DIV>
 
Try adding a div with style="clear:both" like below. That should do it.

Code:
<DIV class=post-content><div>

<img style='float:left;' src="bas08.jpg" border="0"/>This premium chocolate assortment is meant for true connoisseurs. The confections in this basket were crafted by the world-famous Ghirardelli, San Francisco's first chocolatier.

[B]<div style="clear: both;"></div>[/B]

</div></DIV>

Yup. This is a clearing problem. An inner floated <div> container must have a trailing "clear" in order for the parent or outer <div> to fully enclose it. Follow MuonTrail's suggestion.
 
MuonTrail, kanshu you 2 rock!

btw, does this trick work for both firefox and ie? my ie 6 seems to mess up a little bit...
 
MuonTrail, kanshu you 2 rock!

btw, does this trick work for both firefox and ie? my ie 6 seems to mess up a little bit...

Yup. It works for both Firefox and IE.

If you are still experiencing problems with IE, it may be caused by something else.
 
Your problem lies with using float:left on your img.
Floats ignore the structure of everything around them...
Position your image another way (e.g. within another div aligned left etc)
 
perhaps you wanna try using height and width of the border?
 
Back
Top