Forum Moderators: not2easy

Message Too Old, No Replies

floated image finding its way outside container

i know i should know this..

         

natty

7:34 pm on Apr 11, 2005 (gmt 0)

10+ Year Member



hi all,

as i hinted i should know this, and i know a couple of solutions but i am hoping for another

html


<p>
<img src="images/x.jpg" width="50" height="50" alt="x" />
blah blah
</p>

css


p{
border:1px solid red;
clear:both;
}
p img{
float:right;
}

ok as you can see maybe, sorry for lack of complete doc for you to paste somewhere.
that the image will go out of the containg p tag.
not too keen on that
i know if you float the p then it will expand to hold and contained floats. but i dont want to float the p.
so short of adding a


<div style='clear:both'></div>

before the
</p>
can i do something less .. bad..

any other methods. im sure there are some..

tia

nat

firstreflex

9:39 pm on Apr 11, 2005 (gmt 0)

10+ Year Member



Google "How To Clear Floats Without Structural Markup"