How to add a image? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

How to add a image?

I want add a image. In my HTML code. How I can do it

13th Aug 2022, 5:44 PM
Shihavul Islam
Shihavul Islam - avatar
4 Answers
0
There are 2 ways Its by the url source or filepath Url <img src="http://url of the image.com" alt="image description"> Filepath from computer directory <img src="user/image/imagesampleq.png" alt="image desc"> Background for body <body style="background-image:url ("filepathe or url")"> goodluck Watch more videos
14th Aug 2022, 11:38 AM
Allen Jester O Garalde
Allen Jester O Garalde - avatar
0
<img src=imagename alt=name/> image is one of the tags in html that is having only opening tag We can set background of a page as image Background of a table frame as image Here are some of the format png - Portable Network Graphics gif - Graphic Interface Files jpg - Joint Photography Expert Group
15th Aug 2022, 9:37 AM
sree harsha
sree harsha - avatar
0
if you want to add an image that is saved on your device into your html code you’d add this line of code: <img src=“example.jpg” alt=“image desc”/> or if you are adding an image from the web into your html code, insert the url of the image instead of a file name. <img> is the tag to insert an image into html code. there is no need for a closing tag. src stands for source code and is an attribute to specify a url for an external file or resource (ex. images saved on your pc, url that will direct you to an image on the web, etc.) alt is for alternate text. if, for any reason, your image does not load properly it will instead display text you placed to describe the missing image. if the image displays then the alt text you provided will not display as it is not needed. including the alt attribute in your code is not necessary, but it is useful.
15th Aug 2022, 8:41 PM
keyatta
keyatta - avatar