Search code examples
htmlimagesrcdisplay

where is my html page in visual studio?


I know I need to put my image in the html folder of my project in order to be able to display it .When I use it doesn't display anything only the given alt tag of the picture. I was wondering if it will work if I put my P7220399.JPG image in the folder where my .sln project file is located, but it doesn't seem to work that way either! I am using visual studio.

    <header>
        <img src="P7220399.JPG" alt ="win" title ="products" style ="width: 304px;height:228px;"/>
    </header>

in the example above the .JPG is in the project directory where my .sln file is located.

what should I do to display the image??


Solution

  • First:

    Create a folder in your solution named "Images", and place all your images in this folder. From than, make your source-url like this: /Images/P7220399.jpg.

    How the rooting works in your solution:

    Lets say this is your solution:

    Layout

    Let's say your page is in the Views folder, you will need to get one folder back to the main folder, and after that to the Content and than the Images folder. Your source-url will look like:

    ../Content/Images/P7220399.jpg

    The ../ is for getting one folder back from the current folder you are.