Showing image

Frank Mehlhop 66 Reputation points
2022-07-29T07:00:36.403+00:00

A image in my Blazor site is not shown.

In NavMenu.razor I implement:

<img href="/graphics/logo/logo_white.png" asp-append-version="true" alt="logo" />  

On the page I see only the html placeholter.

226038-image.png

The image path is fine I think.
How can I show a image from the project?

226023-image.png

Developer technologies | .NET | Blazor
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Anonymous
    2022-08-01T02:12:57.217+00:00

    Hi @Frank Mehlhop ,

     <img href="/graphics/logo/logo_white.png" asp-append-version="true" alt="logo" />    
    

    Please check your code, when specifies the path to the image, it should use the src attribute, instead of the href attribute.

    So try to change your code as below:

     <img src="/graphics/logo/logo_white.png" asp-append-version="true" alt="logo" />  
    

    Refer to the following screenshot:

    226470-image.png

    If still not working, try to clean and rebuild the project, and you can also use F12 developer tools to clear the cache.


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    Best regards,
    Dillion

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.