Embedding image on html

My HTML code for Embedding the images has worked for the code you have given in the class embedding images. But i am not able to embedde different image in the folder in which i have saved my html file and also given the extension of image as .jpg along with image name. How should i embedde the different image ??

Please show the image of your code

1 Like

1.Download any different image and save it in the folder containing html file with the extension .jpg …say (image2.jpg).
Note: Select your file types as jpeg while saving .And save it in the same folder as your html file …else you would have to specify the path.

2.In your html file use the code
Capture2

You 'll get the image on your webpage

Apply css for formatting

Hope this helped !!

@ddwivedi132001

If your image is in a different folder, then you have to provide the full pathname instead of just filename.

Hi, if you are trying to embed an image which you have downloaded from the internet into your code, then you first have to save the downloaded image in the folder in which you have saved your html file and then you put the image name with proper extension and try to run the code.
I hope you will be able to see the specified image in the output.

1 Like

Okay I will try this

Hello
I also done the same and my output is coming. But i cannot understand that if the image already is stored in computer , Why do we have to paste in the folder which contains our HTML file extension. Sublime Text cannot Search the image in the computer?
Thank You!

@sarthakagg105

None of the text editors have the property to SEARCH. In case you want to embed an image that is present in some other folder, you have to provide the complete location of the image file.

For example - D:\OrCad\Capture\Library\image.png inside the src attibute.

For embedding the image using html the following syntax must be followed
SYNTAX