Insert Image via CSS or HTML?

Asked

Viewed 11,465 times

1

Hello! I have a question about the difference in the ways to insert images.

I know I can insert images through HTML and by CSS. But what’s the difference? And in what situation should I use each of them in the right way ?

2 answers

3

Grossly. When you put the image directly into HTML it is somewhat "registered" in search engines, as in Google, so users can find you through Google Images, and it is easier for your users to download their images (Right Mouse Button > Save Image Like, this in Windows, for example). With the CSS it is not "registered" in the searchers and it is a little more difficult for its users to download the image.

There is the fact of accessibility, that with HTML you can provide your users, I don’t know a way to do this with CSS.

  • 1

    thanks! already helped me a lot. i have an image to insert in the header of my site . was in doubt if used by CSS or HTML. I believe that HTML is ideal right ?

  • I’m glad I helped :D. I believe so, usually in the header if you put soon or some important image of the product, so it’s like I said, it can help you rank in Google Images or to facilitate your own user download.

-1

Actually the way you put your question is wrong, the right way would be:

  • In HTML

<img src="exemplo.jpg" />

Above is how to insert an image into the HTML page through tag img

  • In the CSS

body {
  background-image: url("exemplo.jpg");
}

Already in this second form, you are putting an image not as an element in the page, but as a background image of some element of the page.

  • 1

    I believe you understand the question.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.