Home > Back-end >  HTML background image insert
HTML background image insert

Time:05-16

I am new into coding. I am currently trying to build a personal website. When adding an background image, is adding it to a free image hosting service to get the url the only way to do this? Or can I make it to where I can insert the image from my desktop files??? I have tried <img src= then adding the img jpg but doesn't seem to be working. any tips?

CodePudding user response:

The <img> tag src specifies the path to the image.

<img src="stackOverflow.jpg">
  1. Image in Another Folder: If you have your images in a sub-folder, you must include the folder name in the src attribute.

    <img src="/images/hello.jpg">
    

    Here / is used to navigate inside sub-folder.

  2. Images on Another Server/Website: To point to an image on another server,an absolute URL in the src attribute is used.

    <img src="abc.com">
    

To move to previous folder use ... Ex-

<img sr-c="/images/hello.jpg">
  • Related