Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Div Float with Image [closed]

When I float a div with text it in the behavior is what I want but when I put an image inside, the float dosen't behave the same way and the image then goes down one line. Why is that?

like image 946
RoR Avatar asked Oct 24 '25 17:10

RoR


1 Answers

Put the image before the text if you want the text on the right side of the img. to make sure the text flows to the right of the img float:left.

<div  style="float:left;">
<img src="someimg" style="float:left;"/>
<p>Text will pop on right</p>
</div>

if you first want text then image

<div  style="float:left; width:200px;">
<p style="width:80% float:left;">Text will pop on left</p>
<img src="someimg" style="width:20%"/>
</div>
like image 55
Thomas Andreè Wang Avatar answered Oct 26 '25 08:10

Thomas Andreè Wang



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!