<img ...>
<p>..</p>
Without setting align="left"
on img
,p
will start from a blank line.
<img ... align="left">
<p>..</p>
But after setting align="left"
,p
will come up around img
,why?
<img ...>
<p>..</p>
Without setting align="left"
on img
,p
will start from a blank line.
<img ... align="left">
<p>..</p>
But after setting align="left"
,p
will come up around img
,why?
I guess that <img>
align attribut will work like CSS float property. It makes your image float. If you want <p>
to stay under <img>
so you should do it like this.
<img ... align="left" />
<div style="clear: both;"></div>
<p>..</p>
Float image to left or right using CSS
HTML uses the align attribute:
<img src="image.jpg" align="right">
XHTML uses an inline style:
<img src="image.jpg" style="float: right" />
The proof: HTML img align Attribute
The align attribute of
<img>
is deprecated, and is not supported in HTML 4.01 Strict / XHTML 1.0 Strict DTD.Use CSS instead.
CSS syntax:
<img style="float:right" />
Setting align html attribute to left or right on an image is equivalent to css floating the image.
Read about inline and block elements. I don't remember any good site (in English) with explanation of difference between these two types right now, so try to Google it.
Setting align="left"
(this should be converted to its equivalent in CSS: float: left
) makes img
element floating. Once again read about floats.
Perhaps it's better to try :
<p><img align="left" /></p>
Or may be :
<img align="left" />
<p style="clear:left"></p>