Hello! I am having a question about the difference in how to insert images.
I know that I can insert images by HTML and CSS . But what's the difference? And in what situation should I use each of them in the right way?
Hello! I am having a question about the difference in how to insert images.
I know that I can insert images by HTML and CSS . But what's the difference? And in what situation should I use each of them in the right way?
Roughly. When you put the direct image in HTML it is somehow "registered" in search engines, such as Google, so users can find you through Google Images, and it is easier for your users to download your images (Right-click> Save Image As, this in Windows, for example). With CSS it is not "registered" in search engines and it is a bit more difficult for your users to download the image.
It has the accessibility fact, that with HTML you can provide to your users, I do not know a way to do this with CSS.
In fact the form you put in your question is the wrong way, the correct one would be:
<img src="exemplo.jpg" />
Above is how to insert an image into the HTML page using tag img
body {
background-image: url("exemplo.jpg");
}
In this second form, you are placing an image not as an element on the page, but as a background image of some element of the page.