Forum Moderators: not2easy

Message Too Old, No Replies

Problem floating images

float images into div

         

avlisodraude

9:11 am on Oct 8, 2009 (gmt 0)

10+ Year Member



Hi,
I am new to web design and I came with this problem.
While designing my webpage I created a DIV container at which I apply a class called "geweest".
I want to float images to the right, but the problem is that when the text to the left of the image uses less space than the image itself the DIV container stretches only up to the text, so the image goes outside the DIV container.
I would really appreciate any help.
This is the code for the "geweest" class.

.geweest{ padding:5px 0px 5px 0px; margin-bottom:7px; }
.geweest img{ float:right; margin-left:9px; margin-top:3px; padding:2px; border:1px solid #666;}
.geweest p{ padding-left:10px;}

Best regards,
avlis

swa66

11:27 am on Oct 8, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Simple enough: a float should not be encompassed by a parent.

To get what you seek: add e.g. overflow:auto to the parent.