The codes can be found here:
http://www.w3schools.com/css/tryit.asp?filename=trycss_float_elements
&l
It's depends from browser engine, but difference is about this:
If the part of HTML page with image is visible.
Then you add width
and height
attributes to img
tag the browser will know some(not final) image size before image is loaded and will add it native cap for images with images size. So browser will add some space(for image) on HTML page.
If the part of HTML page with image is not visible.
Then you add width
and height
attributes to img
tag the browser will know some(not final) image size before image is loaded and can calculate for example offsetWidth
or offsetHeight
of image container right. Also width/height
attributes will save you from image HTML container repaint
if you don't crop image from css, because browser already add some space for image.