When you don’t declare the <!DOCTYPE>
the browser enters the Quirks Mode, this means that it will render in some old version of HTML, this is used when you need a new browser to support a very old site.
Link for you to find out more: https://developer.mozilla.org/en-US/docs/Web/HTML/Quirks_Mode_and_Standards_Mode
Already with the <!DOCTYPE>
defined, the browser renders with modern Web Standards. And one of the conventions is that the tag <img>
by definition is an element of the type inline
that is, it has the composition of a common text, so the "margin" appeared in the image.
To fix this there are several solutions, there will depend on the structure of your code and what you want for the layout. But the most common is to define the image as a block type element like this:
img {display:inline-block} /* esse é o padrão dos browser modernos */
You can read more about it here: https://developer.mozilla.org/en-US/docs/Archive/Misc_top_level/Images,_Tables,_and_Mysterious_Gaps
This Doctype is HTML 5, right? HTML5 has some different influences.
– William Aparecido Brandino
Enter your code so we can see . Only by the image I can not help you
– Luã Vieira