Home > Blockchain >  Why can I not see the images from my computer on my website in html?
Why can I not see the images from my computer on my website in html?

Time:03-31

I'm trying to add an image into my html file directly from my computer but it wont show up on my webpage.

I have a folder named portfolio containing my html file and css file. Under portfolio I have another folder named images containing all my images I wish to use.

This is the code I'm using.

 <div >
       <img  src="images/project-1.jpg" />
      <img  src="images/project-2.jpg" />
      <img  src="images/project-3.jpg" />
      <img  src="images/project-4.jpg" />
    </div>

CodePudding user response:

this would be correct if the folder "images" is inside the "portfolio" folder

try using src="../images/project-4.jpg" instead

edit: if by "under" it you mean inside it, try changing the "../" with "./" it could also be a typing mistake so make sure to copy the folder/images names

CodePudding user response:

images folder and the file (index.html) in which you are using these images must be in same root directory (portfolio) folder.

 ---  index.html(file)
|
|         <div >
|            <img  src="images/project-1.jpg" />
|            <img  src="images/project-2.jpg" />
|            <img  src="images/project-3.jpg" />
|            <img  src="images/project-4.jpg" />
|         </div>
|    
|
|
 ---  images(folder)

         project-1.jpg
         project-2.jpg
         project-3.jpg
         project-4.jpg
  • Related