HTML Image not displaying, while the src url works

前端 未结 8 854
死守一世寂寞
死守一世寂寞 2021-02-04 02:59
\"Image

That doesn\'t d

相关标签:
8条回答
  • 2021-02-04 03:17

    my problem was not including the ../ before the image name

    background-image: url("../image.png");
    
    0 讨论(0)
  • 2021-02-04 03:19

    You can try just putting the image in the source directory. You'd link it by replacing the file path with src="../imagenamehere.fileextension In your case, j3evn.jpg.

    0 讨论(0)
  • 2021-02-04 03:24

    My images were not getting displayed even after putting them in the correct folder, problem was they did not have the right permission, I changed the permission to read write execute. I used chmod 777 image.png. All worked then, images were getting displayed. :)

    0 讨论(0)
  • 2021-02-04 03:27

    In your angular.json folder structure should be like this

    "assets": [             
      "src/assets",
      "src/favicon.ico"
    ],
    

    not this

    "assets": [     
      "src/favicon.ico",
      "src/assets",
    ],
    

    This solved my problem.

    0 讨论(0)
  • 2021-02-04 03:30

    The simple solution is:

    1.keep the image file and HTML file in the same folder.

    2.code: <img src="Desert.png">// your image name.

    3.keep the folder in D drive.

    Keeping the folder on the desktop(which is c drive) you can face the issue of permission.

    0 讨论(0)
  • 2021-02-04 03:33

    It wont work since you use URL link with "file://". Instead you should match your directory to your HTML file, for example:

    Lets say my file placed in:

    C:/myuser/project/file.html
    

    And my wanted image is in:

    C:/myuser/project2/image.png
    

    All I have to do is matching the directory this way:

    <img src="../project2/image.png" />
    
    0 讨论(0)
提交回复
热议问题