Divs and spans are kind like wildcard tags that have no semantic meaning. You can use them to group or identify elements when no other tag is appropriate (like tables, lists or headings). Their differences are:
div
span
You can always change their default display property with css, but you cannot change the type of elements they can contain, regardless of the display property value. For instance:
<span style="display:block">
this will be displayed like a div,
but still cannnot contain block level elements
</span>
Because they are "generic" tags, they're usually used for microformats in conjunction with classes. For instance: <span class="tel">555-5555</span>
, because there is no <tel>
tag.
As for the image wrapping, if the image is directly related to the text, you could use:
<p><img src="image.jpg" style="float: right" alt="my image" />Long paragraph.</p>
And no divs or spans would be required. However, if it is not, then you could use:
<p>unrelated to the image</p>
<div>
<img src="image.jpg" style="float: right" alt="my image" />
<p>Long paragraph.</p>
</div>
Here div
is necessary because p
is a block level element.
Finally, for more information you can check the official W3C spec topic about divs and spans.