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

How to make a image in html?

I dont understand what<img src="tree.jpg" alt="" /> what is tree . Will the output is a baground of tree?

7th Jul 2019, 4:09 PM
DEVA SURYA
DEVA SURYA - avatar
4 Answers
+ 1
The img element has the attribute src. It accepts links, and it will display that link (if it is an image). The alt attribute is there if the image can't load (e.g. no connection)
7th Jul 2019, 4:14 PM
Airree
Airree - avatar
+ 1
Thanks for ans
7th Jul 2019, 4:22 PM
DEVA SURYA
DEVA SURYA - avatar
+ 1
tree in tree.jpg is the name of the image and tree.jpg is the filename. So if you have that piece of code saved on your desktop, the code will search for ../Desktop/tree.jpg and if you don't have an image saved on your desktop, it will show the text in alt="". And yes, this tree.jpg is a picture of a tree, but don't get confused with that. If they changed the name to NotATree.jpg, it would still be the same picture
8th Jul 2019, 2:20 AM
Roel
Roel - avatar
0
But what is the use of tree
7th Jul 2019, 4:25 PM
DEVA SURYA
DEVA SURYA - avatar